Search code examples
pythonpipdependenciescondarequirements.txt

pip fails to install all packages from requirements.txt


I created and maintain a package seg-metrics. But I found that I can not install all of its dependencies when I use pip install seg-metrics to install it, even though I have already included all necessary dependencies into the requirements.txt.

Can you tell me why and how to solve it?

You can try to reproduce it into your own pc.

  1. conda create -n test_env python=3.8 pip # install pip as well
  2. pip install seg-metrics # install the package
  3. pip list # shown the installed package, you can see seg-metrics, but you can not see the dependencies like: SimpleITK and medutils. This can be verified by the following commands.
  4. python # enter the python interpreter
  5. import seg_metrics.seg_metrics as sm # Error occured here !!!

Solution

  • Thanks to @phd, I found that I should set install_requires in setup.py. After that, this issue was fixed.