2

I ran a provided shell file and a requirements.txt file and that shell file created the virtual environment using virtualenv. However, I do most of my coding work using Anaconda. Is that possible to use conda to activate and manage my virtual environment? Since I haven't used a virtual environment before, I don't know how to create a new virtual environment without the provided files. Thanks for help.

This is the shell file create_venv.sh:

#!/bin/bash

# this installs the virtualenv module
python3 -m pip install virtualenv
# this creates a virtual environment named "env"
python3 -m venv env
# this activates the created virtual environment
source env/bin/activate
# updates pip
pip install -U pip
# this installs the required python packages to the virtual environment
pip install -r /Users/linghu/Desktop/CSCI\ 2470/hw1-mnist-lah-dee-dah-master/requirements.txt

echo created environment

This is the requirements.txt file:

setuptools==41.2.0
tensorflow==2.5.0
matplotlib==3.5.1
gym==0.19.0
ghast==0.1.0
dgl==0.6.0
future==0.18.2
numpy==1.19.3
periodictable==1.5.1
tensorflow-gan==2.0.0
tensorflow-hub==0.9.0
imageio==2.9.0
tqdm==4.48.2
  • I'm honestly wondering if a general tutorial on the use of Python's venv wasn't the right start for you. I mean, you can always run those programs without writing the commands in a file and also install requirements manually. So, what is your question? Please, as a new user here, also take the [tour] and read [ask]. – Ulrich Eckhardt Feb 12 '22 at 08:34

1 Answers1

-1

This is one of the great things about Anaconda. Simply the command conda create --name <env_name> --file requirements.txt should create your new virtual environment.

Here is the link on general management of anaconda environments: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html

Hannah
  • 39
  • 2