pip packages not included in “conda env export”

前端 未结 4 493
太阳男子
太阳男子 2021-02-05 06:36

My python project runs on a conda virtual environment. I install packages on the environment with conda install whenever that package is available for installing th

相关标签:
4条回答
  • 2021-02-05 07:04

    I was able to solve this problem just by running this in a command window with admin privileges:

    activate <env-name>
    conda update pip
    

    After that, exports of the available packages on my environment contain again both the packages installed with conda and those with pip.

    I suspect I may have caused this package export problem because I had followed the instruction that pip gave earlier on, when I was executing a package install:

    "You are using pip version 9.0.3, however version 10.0.1 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' > command."

    So updating with python -m pip install --upgrade pip broke my package exports, but conda update pip fixed it.

    0 讨论(0)
  • 2021-02-05 07:11

    For me this only appeared using the conda package pip 18.1_py36_0 (didnt try any other versions). So i downgraded pip in the virtual environment to version 10 via

    conda install pip=10
    

    After this the export was listing the pip packages again.

    Also see this pull request for conda https://github.com/conda/conda/pull/7612 which fixes the issue for conda 4.6.2. It also was backported to conda 4.5.10. Currently there is no conda 4.4.x backport.

    0 讨论(0)
  • 2021-02-05 07:18

    If you have installed pip with anaconda and used it to install the packages then conda-env does this automatically.

    So basically you can export your environment with

    conda env export -n <env-name> > environment.yml

    Otherwise

    Please refer to this link

    0 讨论(0)
  • 2021-02-05 07:22

    At the moment of writing this post, because of an issue with reading pip lists by anaconda, conda export command only exports packages installed via conda install packagename and ignores the pip ones.

    You can try reinstalling your packages via conda install and see if it generates the environment.yml file correctly.

    0 讨论(0)
提交回复
热议问题