5

I understand I can export conda environments with syntax like so:

conda env export -n my_env -f /somewhere/environment.yml

And import them with:

conda env create -f /somewhere/environment.yml -p /somewhere/else/

However, if there is a package I have installed from my private github, using syntax like so:

(my_env) ~/ $ pip install git+https://github.com/user/my_package.git@master#egg=my_package

Or have this in my requirements.txt, like so:

aiofiles==0.4.0
git+https://github.com/user/my_package.git@master#egg=my_package
chardet==3.0.4

When I do my export, I see this:

name: my_env
channels:
  - defaults
dependencies:
  - ca-certificates=2019.5.15=0
...
  - pip:
    - aiofiles==0.4.0
    - my_package   # UH OH, NO github INSTRUCTION OR VERSION
    - chardet==3.0.4

This is a problem, because when I try to run:

conda env create -f /somewhere/environment.yml -p /somewhere/else/

I get an error that conda fails to install because it cannot find my_package. And this makes sense, the environment does not tell it to look in github.

How can I ask the conda env export command to be github-pip-installation-aware so that I can faithfully re-create my conda environment without the export failing? (Or even to do this in such a way I won't create exports that are doomed to failure? Ie, this export takes a rather long time---it would be helpful if the export command would fail fast before spending tens of minutes producing an export that cannot be imported.)

Unlike this similar question, I am not using wheels.

Mittenchops
  • 18,633
  • 33
  • 128
  • 246
  • I just tested this and can confirm it also doesn't work for me. However, I would note that activating the env and running `pip freeze` also fails to give me the GitHub URLs, which makes me think this is really a pip issue. How does `pip freeze` behave for you? – merv Sep 13 '19 at 16:39
  • @merv `pip freeze` does freeze this, u will see something like this in the frozen text file: `-e git+https://github.com/rcmalli/keras-vggface.git@6943be9d81396ab4083ecff4a8014e99d59b502c#egg=keras_vggface` – lnshi Oct 25 '19 at 07:20
  • actually i tested: after u have done the `conda env export > environment.yml` just go to manually modify the file and put the `-e git+https://github.com/rcmalli/keras-vggface.git@6943be9d81396ab4083ecff4a8014e99d59b502c#egg=keras_vggface` like stuff as one item of the pip list in the yml file, then u will be able to replicate a new conda environment properly with this yml file – lnshi Oct 25 '19 at 08:36
  • @lnshi yes, agreed: *if* you install in development mode (i.e., with `-e`) then it will show up, but otherwise it doesn't seem to appear. – merv Oct 25 '19 at 15:56

0 Answers0