How to install matplotlib 3.2.x on Ubuntu 16.04? - matplotlib

Tried several methods to install matplotlib on Ubuntu 16.04, but failed miserably. First I ran
sudo apt-get install python3-matplotlib, it always installed matplotlib 1.5.1 and I wanted the latest version 3.2.1. So I purged it and ran pip3 install matplotlib and what I got was always the following error
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-hse72gvy/matplotlib/setup.py", line 139
raise IOError(f"Failed to download jquery-ui. Please download "
^
SyntaxError: invalid syntax
which seems to suggest that I must install jQuery-UI. I haven't found any working solutions on the internet. Any more has a tip or solution?

Related

ModuleNotFoundError on venv after upgrade to Ubunbtu 20.04

I've just upgraded my home server OS to Ubuntu 20.04 and having funny problems.
It seems like somehow python's PATH information is messed up.
Traceback (most recent call last):
File "/home/myname/dirname/venvname/bin/pip3", line 6, in <module>
from pip._internal import main
ModuleNotFoundError: No module named 'pip'
After brief research, I've figured out Ubuntu 20.04 dropped support on Python2.
So I installed Python2 and pip manually and tried the above command again, but still throwing the same error.
Traceback (most recent call last):
File "/home/myname/dirname/venvname/bin/gunicorn", line 6, in <module>
from gunicorn.app.wsgiapp import run
ModuleNotFoundError: No module named 'gunicorn'
Moreover, It throws the same kind of error for Gunicorn.
So, I believe this is not a problem just related to Python2.
I know it is insufficient information for diagnostic, but I have no idea what would be helpful.
So any guess or ask for additional information would be appreciated.
EDIT 1) I've reinstall python on venv with
sudo apt purge python3
sudo apt install python3
and still have the same problem.
Does python3 -m pip works? I am not sure if it would work, but I resolved this kind of error by invoking pip like this previously.
After some tries, I've give up the original venv and make a new one. There was some chore to setup venv and project again, but it works just fine.
If anyone has the same issue, consider re-make another venv.

Failed building wheel for pyarrow

I am trying to pip install Superset
pip install apache-superset
and getting below error
Traceback (most recent call last):
File "c:\users\saurav_nimesh\appdata\local\programs\python\python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\saurav_nimesh\appdata\local\programs\python\python38\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\saurav_nimesh\AppData\Local\Programs\Python\Python38\Scripts\cmake.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'cmake'
error: command 'C:\\Users\\saurav_nimesh\\AppData\\Local\\Programs\\Python\\Python38\\Scripts\\cmake.exe' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pyarrow
Failed to build pyarrow
ERROR: Could not build wheels for pyarrow which use PEP 517 and cannot be installed directly
Tried Installing Windows 10 sdk and updating Visual studio tools
Please help with basic step, I am level 0 in python doing it just to get to Superset
Apache Superset is pinned on pyarrow==0.15.1 which is not available on Python 3.8, and I don't recommend trying to get the build-from-source to work.
Please ask the Superset developers to update to pyarrow==0.16.0 or higher. In the meantime, you can use Python 3.7 or lower.
I solved it by upgrading pip setuptools wheel based on another ancient post.
pip install --upgrade pip setuptools wheel
Re: https://github.com/pydata/bottleneck/issues/281

numpy.test error in virtualenv with ERROR: test_multiarray.TestNewBufferProtocol.test_relaxed_strides

In my ubuntu system,i install numpy in virtualenv with python 2.7. After i install it, using the numpy.test:
python -c "import numpy; numpy.test()"
there are some errors like this:
ERROR: test_multiarray.TestNewBufferProtocol.test_relaxed_strides
Traceback (most recent call last):
File "/home/zjd/wangliangguo/theano-env/local/lib/python2.7/site- packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/zjd/wangliangguo/theano-env/local/lib/python2.7/site-packages/numpy/core/tests/test_multiarray.py", line 5366, in test_relaxed_strides fd.write(c.data)
TypeError: 'buffer' does not have the buffer interface
I had the same error with Python 2.7.3. Upgrading to Python 2.7.11 fixed it for me.
I'm on Ubuntu 12.04 LTS, and the default apt-get repositories didn't have Python 2.7.11, so I followed these instructions: https://superuser.com/a/942296

Install matplotlib with Plone 4.3.3 via buildout [duplicate]

When I try to upgrade my matplotlib using pip, it outputs:
Downloading/unpacking matplotlib from https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.4.0.tar.gz#md5=1daf7f2123d94745feac1a30b210940c
Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded
Running setup.py (path:/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.4.0]
python: yes [2.7.6 (default, Mar 22 2014, 22:59:38) [GCC
4.8.2]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.8.2]
six: yes [using six version 1.7.3]
dateutil: yes [using dateutil version 2.2]
tornado: yes [using tornado version 4.0.1]
pyparsing: yes [using pyparsing version 2.0.2]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>
result = package.check()
File "setupext.py", line 940, in check
if 'No such file or directory\ngrep:' in version:
TypeError: argument of type 'NoneType' is not iterable
Complete output from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.4.0]
python: yes [2.7.6 (default, Mar 22 2014, 22:59:38) [GCC
4.8.2]]
platform: yes [linux2]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.8.2]
six: yes [using six version 1.7.3]
dateutil: yes [using dateutil version 2.2]
tornado: yes [using tornado version 4.0.1]
pyparsing: yes [using pyparsing version 2.0.2]
pycxx: yes [Couldn't import. Using local copy.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module>
result = package.check()
File "setupext.py", line 940, in check
if 'No such file or directory\ngrep:' in version:
TypeError: argument of type 'NoneType' is not iterable
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Storing debug log for failure in /home/username/.pip/pip.log
In the tail of the log it says:
Exception information:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1229, in prepare_files
req_to_install.run_egg_info()
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 325, in run_egg_info
command_desc='python setup.py egg_info')
File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_root/matplotlib
Why did it fail?
Many thanks!
This is a known bug that has been fixed (https://github.com/matplotlib/matplotlib/pull/3414) on master.
The bug is in the handling of searching for a freetype installation. If you install the Linux package freetype-dev, you will avoid this bug and be able to compile matplotlib.
sudo apt-get install libfreetype6-dev
On Ubuntu 14 server, you also need to install libxft-dev
sudo apt-get install libfreetype6-dev libxft-dev
I had the same issues trying to install matplotlib on Python 3 using pip3, and it seems that this problem is related to a bare-bones installation of Python 3, and doing a:
sudo apt-get build-dep matplotlib
followed by
sudo pip3 install matplotlib
is probably a better solution than selectively installing only the libraries related to matplotlib.
Since mac doesn't have apt-get you, on OSX you may need to do:
brew install freetype
then you can run:
pip install matplotlib
Found this page while looking answer for fedora 24.
RPM solution is:
dnf install freetype-devel
If you re running Ubuntu server 14.04 u should add this font dependency
sudo apt-get install libxft-dev
Source
I was trying too update directly using sudo pip but changes are not saved in last. So i first use update cmd in terminal:
sudo apt-get update
then i used sudo install:
sudo apt-get install libffi-dev
Finally its installed by doing this method.
For those on Fedora 25 hitting this thread, I needed these two packages to make it work:
sudo dnf install freetype-devel gcc-c++
This worked for me:
python -m pip install -U pip setuptools
python -m pip install matplotlib
For more details, follow : https://matplotlib.org/2.0.0/users/installing.html

My ipython and libraries disabled after installing OS X 10.8 (Mountain Lion)

I have a problem similar to this one below:
Python pip broken after OS X 10.8 upgrade
After installing ML, I can no longer use iPython, SciPy or Matplotlib. I get this error:
Shanes-MacBook-Pro:~ $ ipython
Traceback (most recent call last):
File "/usr/local/bin/ipython", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: ipython==0.14.dev
I have tried the following to fix it:
Using sudo ipython
Installing latest Xcode
Reinstalling SciPy superpack
When I type which python it says it is in /usr/bin/python.
Extra information:
nside /Library/python/2.7/site-packages
Inside there is the following:
DateUtils-0.5.2-py2.7.egg
README
easy-install.pth
nose-1.1.2-py2.7.egg
pika-0.9.5-py2.7.egg
pyzmq-2.2.0.1-py2.7-macosx-10.8-intel.egg
tornado-2.3-py2.7.egg
So with this ML upgrade, it removed my numpy, ipython, etc. And it does not install there anymore like it did with lion. How can I find where it installs too because it seems like it is working when I run the install_superpack shell script.
As an update, I never fixed this specific problem. However, I just downloaded the iPython, SciPy, Matplotlib etc. from Enthought. I answered someone elses question on how to do this here:
How to check whether I have IPython installed on my machine and what sequence to install these libraries?