virtual environment python/conda for Ubuntu 14.04 LTS (Trusty Tahr)

Working with Python
Working with anaconda
anaconda - possible errors

Working with Python

Build the environment 

> virtualenv <YOURPATH>

Start the environment 

> source <YOURPATH>/bin/activate.csh

You can now work with the virtual environment (pip install or what ever you need)

When you finish

> deactivate

 

Working with anaconda

Create environment  

> conda3 create --prefix=<YOURPATH>/<ENV_NAME> python=3.7
to change the package download folder run: conda3 config --add pkgs_dirs <YPURPATH>
(use prefix 'env CONDA_PKGS_DIRS=<PKG_PATH>' to change the cache dir in case you don't have enough storage)

Start the environment  (use bash shell)

> source activate3 <YOURPATH>/<ENV_NAME>

You can now work with the virtual environment (pip install or what ever you need)

When you finish

> source deactivate3
 

Possible error working with python3.7

" pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/pip/"

Solution

tcsh:

> setenv LD_LIBRARY_PATH /usr/local/lib/openssl-1.1.1a/lib:$LD_LIBRARY_PATH

bash:

> export LD_LIBRARY_PATH=/usr/local/lib/openssl-1.1.1a/lib:$LD_LIBRARY_PATH

 

if it says

LD_LIBRARY_PATH: Undefined variable, use:

tcsh:

> setenv LD_LIBRARY_PATH /usr/local/lib/openssl-1.1.1a/lib

bash:

> export LD_LIBRARY_PATH=/usr/local/lib/openssl-1.1.1a/lib

You might meet this error, which solution is to follow the 'Working with anaconda' manual above precisely - note to use bash shell and not tcshell:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run $ conda init Currently supported shells are: - bash - fish - tcsh - xonsh - zsh - powershell See 'conda init --help' for more information and options. IMPORTANT: You may need to close and restart your shell after running 'conda init'. CommandNotFoundError: Your shell has not been properly configured to use 'conda deactivate'. To initialize your shell, run $ conda init Currently supported shells are: - bash - fish - tcsh - xonsh - zsh - powershell See 'conda init --help' for more information and options. IMPORTANT: You may need to close and restart your shell after running 'conda init'.