`UnencryptedCookieSessionFactoryConfig` error when importing Apex

Question:

I’m trying to use Apex and whenever I try to import it (or anything involving it) I get the following traceback:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/anaconda3/lib/python3.8/site-packages/apex/__init__.py", line 13, in <module>
    from pyramid.session import UnencryptedCookieSessionFactoryConfig
ImportError: cannot import name 'UnencryptedCookieSessionFactoryConfig' from 'pyramid.session' (unknown location)

I have the Pyramid library installed and importing that causes no issues. My Python version is 3.8.5 and my OS is Ubuntu 18.04.5.

I’ve tried searching online but haven’t been able to find a satisfactory solution and was hoping to know if anyone who is familiar would be able to provide some tips on what the problem may be and what I can do. Thanks.

Asked By: Sean

||

Answers:

I get the same issue if I use pip install apex.

It turns out that apex on pypi has nothing to do with NVIDIA’s apex and is a totally unrelated, really old package.

To install NVIDIA’s apex do:

git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir 
--global-option="--cpp_ext" --global-option="--cuda_ext" ./

For more info see doc.

Answered By: stason

This will work:

pip uninstall apex
Answered By: Greg Tarr

The code below worked for me

git clone https://github.com/NVIDIA/apex
cd apex
python setup.py install
Answered By: sammens19

Below code has worked for me in colab instance

!git clone https://github.com/NVIDIA/apex
%cd apex
!python3 setup.py install
Answered By: Somex Gupta

use apex/requirements.txt

The code below worked for me

git clone https://github.com/NVIDIA/apex
cd apex
pip install -r requirements.txt
pip install -v --disable-pip-version-check --no-cache-dir ./
Answered By: RuiSheng Tsai

Updated March 2023: Created new virtual environment with corrected python version

conda create --name RSSC python==3.7.10
git clone https://github.com/NVIDIA/apex
cd apex
pip install -r requirements.txt
pip install -v --disable-pip-version-check --no-cache-dir ./
Answered By: Khawar Islam
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.