Installation fails with: No module named 'encodings'

Hi QIIMErs,

I am trying to install QIIME2 for the first time and it fails. I searched for the error but couldn't find posts on it. Happy for any advice!

I am using CentOS and Anaconda. The command I ran:

conda env create -n qiime2-2021.8 --file qiime2-2021.8-py38-linux-conda.yml

Output:

Collecting package metadata (repodata.json): ...working... done
Solving environment: ...working... done
Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... Python path configuration:
  PYTHONHOME = '/home/amitmit/Tools/python'
  PYTHONPATH = (not set)
  program name = '/home/amitmit/Tools/python/envs/qiime2-2021.8/bin/python3.8'
  isolated = 0
  environment = 1
  user site = 0
  import site = 1
  sys._base_executable = '/home/amitmit/Tools/python/envs/qiime2-2021.8/bin/python3.8'
  sys.base_prefix = '/home/amitmit/Tools/python'
  sys.base_exec_prefix = '/home/amitmit/Tools/python'
  sys.executable = '/home/amitmit/Tools/python/envs/qiime2-2021.8/bin/python3.8'
  sys.prefix = '/home/amitmit/Tools/python'
  sys.exec_prefix = '/home/amitmit/Tools/python'
  sys.path = [
    '/home/amitmit/Tools/python/lib/python38.zip',
    '/home/amitmit/Tools/python/lib/python3.8',
    '/home/amitmit/Tools/python/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 0x00002b20ee9b4f00 (most recent call first):
<no Python frame>

done
ERROR conda.core.link:_execute(701): An error occurred while installing package 'conda-forge::widgetsnbextension-3.5.1-py38h578d9bd_4'.
Rolling back transaction: ...working... done

LinkError: post-link script failed for package conda-forge::widgetsnbextension-3.5.1-py38h578d9bd_4
location of failed script: /home/amitmit/Tools/python/envs/qiime2-2021.8/bin/.widgetsnbextension-post-link.sh

Verbose output (6MB)

Hi there @fluhus!

Please share the following with us:

env

and

conda info

Thanks!

Sure! I hope this helps.

$ env
GREEN=\e[1;32m
MANPATH=/SGE6/sge6.2u4/man:/usr/share/man/overrides:/usr/share/man:/usr/local/share/man
SSH_AGENT_PID=115592
HOSTNAME=genie38.mcl2.weizmann.ac.il
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
YELLOW=\e[1;33m
SGE_CELL=default
OLDPWD=/tmp/amitmit
QT_GRAPHICSSYSTEM_CHECKED=1
USER=amitmit
LD_LIBRARY_PATH=/home/amitmit/Tools/gcc/lib64
LS_COLORS=
BLUE=\e[1;34m
SSH_AUTH_SOCK=/tmp/ssh-LqnHAy6yiFkE/agent.115591
PATH=~/Tools/VSCode-linux-x64/bin:~/Data/genie/LabData/Analyses/amitmit/tools/bowtie:~/Data/genie/LabData/Analyses/amitmit/tools/kmc:~/.cargo/bin:~/Tools:~/Tools/7z/p7zip_16.02/bin:/home/amitmit/Tools/gcc/bin:/home/amitmit/Tools/go/tools/bin:/home/amitmit/Tools/go/bin:~/Tools/java/bin:~/Tools/python/bin:~/Tools/git/bin:/SGE6/sge6.2u4/bin/lx24-amd64:/bin:/usr/bin:/usr/local/sbin:/usr/sbin
MAIL=/var/spool/mail/amitmit
LD_RUN_PATH=/home/amitmit/Tools/gcc/lib64
PWD=/home/amitmit/Desktop/kmers/src/run
JAVA_HOME=~/Tools/java
SGE_EXECD_PORT=6445
LANG=en_US.UTF-8
SGE_QMASTER_PORT=6444
KDEDIRS=/usr
SGE_ROOT=/SGE6/sge6.2u4
PYTHONHOME=/home/amitmit/Tools/python
HISTCONTROL=ignoredups
RED=\e[1;31m
HOME=/home/amitmit
SHLVL=2
PURPLE=\e[1;35m
LOGNAME=amitmit
CVS_RSH=ssh
GOPATH=/home/amitmit/Desktop/kmers
LESSOPEN=||/usr/bin/lesspipe.sh %s
NOCOLOR=\e[0m
DISPLAY=math17-lx.wisdom.weizmann.ac.il:3
SGE_CLUSTER_NAME=mcl2
QT_PLUGIN_PATH=/usr/lib64/kde4/plugins:/usr/lib/kde4/plugins
CYAN=\e[1;36m
WHITE=\e[1;37m
_=/bin/env
$ conda info
     active environment : None
       user config file : /home/amitmit/.condarc
 populated config files : 
          conda version : 4.10.3
    conda-build version : 3.18.9
         python version : 3.7.4.final.0
       virtual packages : __linux=3.10.0=0
                          __glibc=2.17=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/amitmit/Tools/python  (writable)
      conda av data dir : /home/amitmit/Tools/python/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/amitmit/Tools/python/pkgs
                          /home/amitmit/.conda/pkgs
       envs directories : /home/amitmit/Tools/python/envs
                          /home/amitmit/.conda/envs
               platform : linux-64
             user-agent : conda/4.10.3 requests/2.25.1 CPython/3.7.4 Linux/3.10.0-514.2.2.el7.x86_64 centos/7.3.1611 glibc/2.17
                UID:GID : 2211:1105
             netrc file : None
           offline mode : False

Thanks @fluhus, I'll ask you to take a closer look at this line from your env var output:

Setting PYTHONHOME is generally considered incompatible with conda:

https://docs.conda.io/projects/conda/en/latest/user-guide/troubleshooting.html#conda-reports-that-a-package-is-installed-but-it-appears-not-to-be

You can check the link above for suggestions on how to resolve.

Thanks @thermokarst!
I unset PYTHONHOME and it installed successfully.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.