2

I am developing a python package at work and intend to make it available to everyone, and it will come along with an environment.yml file that will set up the anaconda environment upon install so everything works out of the box.

I know I can export my anaconda like this:

conda env export > environment.yml

I have a number of packages installed in this environment that were not available using conda install, but were downloaded using pip.

From what I've read here if I have an issue with pip installed packages not showing up in my yml file, I can fix that.

My question is, I have a couple of other custom built packages that are also in this environment. They are stored on our local network, and I basically copied them to my computer and ran python setup.py install to install them.

What is the best way to distribute my new package, but include all dependencies (including the custom built packages)?

Does it make sense to include the zip files of these packages in my folder when I distribute? I haven't ran into this issue before and was hoping anyone could provide a suggestion/advice.

Thanks

Derek Eden
  • 4,403
  • 3
  • 18
  • 31
  • You can share the .zip file with the custom built packages and do a .bat file that runs the `python setup.py install` automatically. Also, for the easy-to-install packages, you can create a list with `pip freeze > installed_modules.txt` and then `pip install -r installed_modules.txt` in the destination PC – Ivan Jan 09 '20 at 14:55
  • If you have a couple of packages that are just shared over local network right now, it might be worth considering to just make a [custom conda channel](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/create-custom-channels.html) where you add the custom packages. – FlyingTeller Jan 09 '20 at 15:13

1 Answers1

0

Here are some approaches that worked for me:

First of all create wheel files out of the custom python packages using 'python setup.py bdist_wheel' command (Build a wheel/egg and all dependencies for a python project).

Two ways you can share the yaml file with the wheel file information:

  1. Upload the wheel file to Github, get the URL and specify the URL to wheel file under 'pip' parameter in the yaml (Specifying a url to a .whl file in a conda env .yml file)
  2. Share a zip to the target user which contains the yaml file as well as the wheel files in the same directory. You can specify the wheel file under the 'pip' parameter:

wheel file

conda env create -f env.yaml

Above command would then either pip install wheel file from URL or look in the directory of the yaml for the wheel files according to approaches above

Prasanjit Rath
  • 166
  • 2
  • 13