8

I failed again and again installing python3.8 on my ubuntu 21.04

Now it is 'ok' but this error message appears from pip (and import ctypes doesn't work too):

    Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
    from setuptools.dist import Distribution, Feature
  File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py", line 35, in <module>
    from setuptools import windows_support
  File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
    import ctypes
  File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
  File "/usr/local/lib/python3.8/_ctypes/__init__.py", line 8, in <module>
    from _ctypes import Union, Structure, Array
ImportError: cannot import name 'Union' from partially initialized module '_ctypes' (most likely due to a circular import) (/usr/local/lib/python3.8/_ctypes/__init__.py)
9
  • What is the install line exactly, normally if you say install python it will be later version, you may have to choose the 2.7/8 version
    – Keith5001
    May 6 '21 at 21:35
  • What version do you actually want to install? The title says 2.7/2.8 but the question is actually about installing 3.8. 3.9 is the default Python version in Ubuntu 21.04, already installed, why do you need 3.8 in particular? And 2.7 can be installed just by installing the python2 package.
    – raj
    May 6 '21 at 21:52
  • sorry, corrected. I need that version for... requirements...numpy pyqt5 pillow -- installs older pillow wich isn't compatible with 3.9!!! gym --- requires older pillow gym-retro --- requires older pillow @raj
    – france1
    May 7 '21 at 8:49
  • 1
    Do these packages you want to install that aren't compatible with 3.9 come from default Ubuntu repositories? I think in that case you should file a bug that they aren't compatible and can't be installed properly. I guess the maintainers should provide in such a case a 3.8 package as a dependency.
    – raj
    May 7 '21 at 9:32
  • 1
    Try it with pyenv or update-alternatives?
    – John Mee
    May 25 '21 at 4:42
1

You could use the project Conda. Conda is for Python environments. Luckily you can choose the Python version you want to use. Check out at conda.io! Once you're in a Python environment, install any package by conda install PACKAGE. Official documentation: https://docs.conda.io/projects/conda/en/latest/user-guide/concepts/packages.html

To create an environment, use conda create To create a Python 3.8 environment, use the python-variable, an example: conda create -n "name" python=3.8 #quotes not required Then: conda use "name" #quotes not required

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.