How to have egg files from github install with pip not in current directory but in the conda env directory?

余生颓废 提交于 2021-01-27 08:01:56

问题


I am creating a python env using conda, pip and yml config file by using first:

conda env create -f test.yml -n test_pip

then

conda env update -f test.yml -n test_pip

with the following .yml file (for test only):

channels:
- defaults
- conda-forge
dependencies:
- python=3.5
- numpy
- scipy
- scikit-learn
- jupyter
- ipykernel
- requests
- pandas
- seaborn
- click
- openpyxl
- matplotlib
- pip:
  - watermark
  - "-e git+https://github.com/slundberg/shap#egg=shap"
  - pytest
  - sklearn
  - autopep8

It works fine but the egg file is install in the current dir "src/shap/" while I would like to have it install with all other python packages installed by conda or pip:

/xxx/anaconda/envs/test_pip

I took this test github directory (I know I can install it with pip install directly) but I would like to use later my own git directory.

Why is the egg not installed here?

/xxx/anaconda/envs/test_pip/lib/python3.5/site-packages/

It is the place where I fin the other packages installed by pip and conda.

Any reason for that ? How can I changed that ?

I am using:

anaconda 4.2.0
conda 4.5.1
pip 9.0.3

回答1:


I don't see any egg file in your config. If by the "egg file" you mean git repository from github than the culprit is option -e — it installs the package in "editable mode". You probably don't need it, so the part of the config should look like this:

- pip:
    …
  - "git+https://github.com/slundberg/shap#egg=shap"
    …

PS. #egg=shap doesn't mean there is an egg file, it's just the way to name the package for pip in VCS (git in your case) URLs so pip could resolve package names and versions before it clones the repositories.



来源:https://stackoverflow.com/questions/50995662/how-to-have-egg-files-from-github-install-with-pip-not-in-current-directory-but

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