Home > database >  Github actions failing to pip install python package with dependency on submodule python package
Github actions failing to pip install python package with dependency on submodule python package

Time:01-03

I am trying to run this github actions workflow but it's not able to pip install my package. My package contains a submodule to another pip package, which is listed in my requirements.txt. When I pip install locally, everything works fine, but when github actions tries to pip install it, it fails with the error:

ERROR: Could not find a version that satisfies the requirement discordAI-modelizer (from discordai) (from versions: none)
ERROR: No matching distribution found for discordAI-modelizer

The checkout step shows that the submodule was initialized, and I ran a test run where I ran ls -la in the submodule directory after the checkout step and all the files were there.

Is there a step I'm missing to get this to work? Or is there some kind of workaround I can use?

CodePudding user response:

first of all, make sure that you correctly specified your package name inside your setup.py file, then if the package that you're using is hosted on a GitHub repo you should include the git prefix on your setup.py file to be able to install the package from the GitHub repo like the below's peace of code:

    install_requires=[    
'your_package @ git https://github.com/user/your-package.git#egg=yourpackage'
]

Also, if the package that you trying to install has a dependency on another package located in a submodule, you should specify the submodule in the dependency specification file by putting &subdirectory=submodule at the end of the above endpoint that I mentioned.

In the end, if you're still facing this issue try to install it manually using the pip command like the below's command line to see if you may get any errors that may help you to solve this issue:

pip install git https://github.com/user/your-package.git#egg=your_package&subdirectory=submodule
  • Related