0

Is it possible to create a python virtual environment (venv) from the local anaconda repository and add packages from there?

  1. I have anaconda distribution installed here:

C: \ ProgramData \ Anaconda3

  1. I want to create a virtual environment for a new project. Here:

C: \ new_project \ venv

  1. For example, I want to add pandas, numpy to location 2) from location 1) Important! I want to add from the location in point 1). I don't want to connect to the internet.

Is it even possible? If not, how can I create a virtual environment based on the installed anconda packages in the operating system?

I know you can add local libraries via pip, but I don't know how to do that with anaconda.

https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-from-a-local-src-tree

Maybe there is a standard?

Marek
  • 1
  • 1
  • `venv` has a `--system-site-packages` option, though that gives you access to *all* system-installed packages, not just a select few. – chepner Nov 22 '22 at 15:46
  • I think(?) you can use `pip` to install from an installed egg, maybe something like `pip install file:///path/containing/your/pacakge#egg=package`? I guess you need to check what metadata is installed alongside your package; maybe what's there can be used as a package source. – chepner Nov 22 '22 at 15:50
  • It should be possible. Try looking [here](https://stackoverflow.com/questions/31729731/how-can-i-install-a-conda-environment-when-offline) – Mercury Nov 22 '22 at 15:51

1 Answers1

0

I did it. https://docs.conda.io/projects/conda/en/latest/commands/install.html

[SOLUTION]

I solved it as follows: "path" - your path "libs" - library names

  1. conda create -p "path" --copy

  2. conda install -p "path" "libs" --offline --use-local

Example:

1.conda create -p c: \ my_project \ venv

2.conda install -p c: \ my_project \ venv scipy numpy pandas --offline --use-local

Marek
  • 1
  • 1