I am having issues with conda. I am working on a cluster (red hat linux), and I successfully managed to use conda, create an environment called envname (containing python2.7) and installing some modules. One day I logged in and I got this error when trying to launch conda (either conda activate envname
or some simple command like conda info
):
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = '/path/to/anaconda3/bin/python'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = '/path/to/anaconda3/bin/python'
sys.base_prefix = '/tmp/build/80754af9/python_1593706424329/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho'
sys.base_exec_prefix = '/path/to/anaconda3'
sys.executable = '/path/to/anaconda3/bin/python'
sys.prefix = '/tmp/build/80754af9/python_1593706424329/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho'
sys.exec_prefix = '/path/to/anaconda3'
sys.path = [ '/tmp/build/80754af9/python_1593706424329/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python38.zip', '/tmp/build/80754af9/python_1593706424329/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python3.8', '/path/to/anaconda3/lib/python3.8/lib-dynload', ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007fbecd9dd740 (most recent call first): <no Python frame>
My goal is to make conda run again with the virtual environment I previously created, without having to install everything from scratch.
I tried to look up similar threads but could not solve the problem. Some possibly relevant informations:
-
By doing source activate envname (what I usually did ti activate the virtual environment) it gives the error
-bash: activate: File o directory non esistente
-
If I use the
python
command right after logging in the cluster, I have a function python (version 2.7). As expected, it does not have installed all the modules I have installed on the conda environment. -
By using the command
which python
, I can see that this python version is located in /usr/bin/python. This folder is not my personal folder on the cluster, rather a global one. So I guess exploring the solution proposed here (Could not find platform independent libraries <prefix>) can't be applied due to permission (although I have not tried it) -
If I try to manually set the PYTHONHOME variable by using
export PYTHONHOME=/usr/bin/python
, not only conda does not work, but also the python command does not work, giving the error "could not import site" -
The same is still true if I try to set to the same path also the PYTHONPATH and PATH variables, in addition to the PYTHONHOME variable.
-
If I unset the PYTHONHOME and other paths, or log out of the cluster and then log in again, python works as described in the first bullet point.
-
Same is true if instead of /usr/bin/python I use the /path/to/anaconda3/bin/python for PYTHONHOME, PYTHONPATH and PATH (it only changes the error message displaying the updated paths)
-
In PATH there are the following paths: '/path/to/anaconda3/condabin', '/usr/bin' (among other paths). If I append to .bashrc the line
export PATH=$PATH:/path/to/anaconda3/bin
and source again the .bashrc file, the problem persists. (this solution was suggested here Can't find my conda environment)
from conda can't find platform independent libraries
No comments:
Post a Comment