Python 3 error: This package should not be accessible on Python 3

python

#1

Hello,

I just set up Cloud9 on my EC2/P2 instance and I want to use the tensorflow_p36 environment.

I created a file something.py and entered “1+1”. When I select “Python2” as a runner, it executes correctly. When I select “Python3”, however, I get the following error message:

Error processing line 1 of /home/ubuntu/anaconda3/lib/python3.6/site-packages/matplotlib-2.2.2-py3.6-nspkg.pth:

Failed to import the site module
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.6/site.py", line 168, in addpackage
    exec(line)
  File "<string>", line 1, in <module>
  File "/home/ubuntu/anaconda3/lib/python3.6/types.py", line 171, in <module>
    import functools as _functools
  File "/home/ubuntu/anaconda3/lib/python3.6/functools.py", line 21, in <module>
    from collections import namedtuple
  File "/home/ubuntu/anaconda3/lib/python3.6/collections/__init__.py", line 32, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/usr/local/lib/python2.7/dist-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.6/site.py", line 541, in <module>
    main()
  File "/home/ubuntu/anaconda3/lib/python3.6/site.py", line 523, in main
    known_paths = addsitepackages(known_paths)
  File "/home/ubuntu/anaconda3/lib/python3.6/site.py", line 320, in addsitepackages
    addsitedir(sitedir, known_paths)
  File "/home/ubuntu/anaconda3/lib/python3.6/site.py", line 207, in addsitedir
    addpackage(sitedir, name, known_paths)
  File "/home/ubuntu/anaconda3/lib/python3.6/site.py", line 178, in addpackage
    import traceback
  File "/home/ubuntu/anaconda3/lib/python3.6/traceback.py", line 3, in <module>
    import collections
  File "/home/ubuntu/anaconda3/lib/python3.6/collections/__init__.py", line 32, in <module>
    from reprlib import recursive_repr as _recursive_repr
  File "/usr/local/lib/python2.7/dist-packages/reprlib/__init__.py", line 7, in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.


Process exited with code: 0

Apparently, there is something wrong with Python3, probably a path or so. What can I do to get the tensorflow_p36 environment running in Cloud9?

EDIT: If I execute the test file in the console with Python3, there is no problem:

ubuntu@ip-172-31-86-1:~/cloud9$ python --version
Python 3.6.5 :: Anaconda, Inc.
ubuntu@ip-172-31-86-1:~/cloud9$ python3 test.py
hello

EDIT: I tried to follow this tutorial, which deals with a somehow similar case. Apparently, the issue has to do with different versions of Python installed:

Thank you and kind regards!