pythonmatplotlibwindows-subsystem-for-linuxpython-3.6python-wheel

Can't install matplotlib in Python 3.6


I've created a Python 3.6 environment in my WSL Ubuntu 22.04 operating system using virtualenv -p python3.6 <my_env>. I need to download some packages, particularly matplotlib, but I'm having some problems.

When I run pip install matplotlib from terminal, it returns me ERROR: Command errored out with exit status 1, as it fails to build wheel for matplotlib, kiwisolver and pillow.

I can't upgrade the Python version.

I don't know what to do, I've tried everything I found online, but it's not working.

Output

Building wheel for matplotlib (setup.py) ... error  
  ERROR: Command errored out with exit status 1:  
   command: /home/andrea/Andrea/env/pyaneti_env/bin/python -u -c  'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-3byxbnl0/matplotlib_5a7e3488d8ed4fa586ccee5566cd5543/setup.py'"'"'; __file__='"'"'/tmp/pip-install-3byxbnl0/matplotlib_5a7e3488d8ed4fa586ccee5566cd5543/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-e23pjohb  
       cwd: /tmp/pip-install-3byxbnl0/matplotlib_5a7e3488d8ed4fa586ccee5566cd5543/
  Complete output (1714 lines):  
[...]  
  AttributeError: install_layout  
  ERROR: Failed building wheel for matplotlib  

Analogue results for kiwisolver and pillow


Solution

  • Here I am answering my own question.
    After trying everything you and the internet suggested, I gave up on using virtualenv.

    As Matt suggested in the comments, I downloaded miniconda and created an environment there. I was able to download all the packages and the code is running nicely.

    Thanks for your help.