How to install local library with pip to a conda environment using environtment.yml file?

我怕爱的太早我们不能终老 提交于 2019-12-11 08:35:05

问题


I want to set up an environment.myl file for a project's conda environment. I have a local package that I would normally use pip install -e . so I can work on the code locally. Is there a way to use pip to install this package with the env file?

I tried this based on something I found using install options with github links, but doesn't work.

name: foo
channels:
  - defaults
dependencies:
  - python=3.7
  - pip
  - pip:
    - /Users/me/projects/package/ --install-option="-e"

回答1:


As far as I can tell from reading the code, conda-env will copy the entries in the pip dictionary and place them into a temporary pip requirements file. Hence, you should follow the Requirements File Format, namely,

name: foo
channels:
  - defaults
dependencies:
  - python=3.7
  - pip
  - pip:
    - -e /Users/me/projects/package

I did a quick test on a local package and I was able to verify that the package installed and shows up in pip list -e.

There is also an advanced-pip/ example in the repo that illustrates some additional options.



来源:https://stackoverflow.com/questions/57835528/how-to-install-local-library-with-pip-to-a-conda-environment-using-environtment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!