0

I have a Jupyter install on an Ubuntu server, which ( due to pip3 command to upgrade all packages, that is careful about dependency conflicts? ) I've started managing via pip-tools (pip-compile and pip-sync).

So, now on that server, I have a list of installed packages (requirements.txt) with their versions, so I don't end up in conflicts.

Now, I would like to somehow use this list in Anaconda on Windows, so as to (hopefully) fix the related Anaconda Python packages, to the same versions that are used on the Ubuntu server. Furthermore, I'd like to use this list in the same way pip-sync does it (that is, if Anaconda notices there is a higher version of the package already installed, and the requested version is still available, it would uninstall the higher-version package, and download and install the requested version).

I am a bit confused, since https://stackoverflow.com/a/63907725/6197439 claims:

There's no problem at all using a requirements.txt file when creating a conda environment.

... then again, a comment in same post ( using requirements.txt to automatically install packages from conda channels and pip in a new conda environment ) says:

requirements.txt is a different format from the output that conda expects. See here: Difference between pip freeze and conda list

And indeed, the output from cat requirements.txt | grep ^jupyter for me gives something like:

jupyter==1.0.0
jupyter-bokeh==3.0.4
jupyter-client==6.1.12
jupyter-console==6.4.0
jupyter-contrib-core==0.3.3
...

... and the output from conda list --export | findstr ^jupyter in Anaconda Prompt (cmd.exe) on Windows for me gives something like:

jupyter=1.0.0=py37_7
jupyter_client=6.1.7=py_0
jupyter_console=6.2.0=py_0
jupyter_core=4.6.3=py37_0
jupyterlab=2.2.6=py_0
...

So, I could write a simple script to transform the jupyter==1.0.0 of requirements.txt into jupyter=1.0.0 of conda list --export - but I have no idea what to do with those =py_0 and such ...

And also, once I do have a list that is usable in conda, I cannot tell how to get the behavior of pip-sync (that is, for a present package not on the same version as required, uninstall the package, then install the correct version).

Is this possible to do somehow?

sdbbs
  • 3,071
  • 3
  • 21
  • 58

0 Answers0