I get this error when i try to import matplotlib. I have installed matplotlib.
Traceback (most recent call last):
File "<pyshell#23>", line 1, in <module>
import matplotlib
File "C:\Python27\lib\site-packages\matplotlib\__init__.py", line 110, in <module>
raise ImportError("matplotlib requires dateutil")
ImportError: matplotlib requires dateutil
how do I solve this problem?
matplotlib depends on dateutil
On Linux you can install it using
pip install python-dateutil
You can reinstall them forcefully using
pip install python-dateutil --force-reinstall --upgrade
To install pip on windows get the script get-pip.py from here. Then on cmd run
python get-pip.py
Related
I am trying to import H5PY in my Python code, but the module cannot be found. I am using Ubuntu 16.04 and Python 2.7.
I have tried reinstalling h5py both with conda and with pip and individually and the following
sudo pip install cython
sudo apt-get install libhdf5-dev
sudo pip install h5py
but it still does not work.
Installing h5py tells me that it is already installed in /anaconda2/lib/python2.7/site-packages.
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/snap/pycharm-community/128/helpers/pydev/_pydev_bundle/pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ImportError: No module named h5py
Has anyone fixed this problem?
I found my solution!
I added found out the path where h5py is installed and added it to the path where python looks for the modules with
import sys
sys.path.append("mypath")
Hope this also helps others
For me the following worked:
sudo apt-get update
sudo apt-get install python3-h5py
Ref: https://www.devmanuals.net/install/ubuntu/ubuntu-16-04-LTS-Xenial-Xerus/how-to-install-python3-h5py.html
creating my first module in django,
I am using mac Tried steps:
1.installed python 3.6.+ version,
2.cloned git project
3.setup local env,
to create a module,
trying with command
env=dev python3 manage.py startapp supriya_module_inflow;
getting error in console :
Environment Selected :dev
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 24, in <module>
import MySQLdb as Database
ModuleNotFoundError: No module named 'MySQLdb'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 35, in <module>
execute_from_command_line(sys.argv)......
...
raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'
MySQLdb does not support Python 3. You'll want to pick one of the other MySQL drivers.
At the time of writing, the latest release of MySQLdb (1.2.5) doesn’t support Python 3. In order to use MySQLdb under Python 3, you’ll have to install mysqlclient instead.
Here is How to install mysqlclient in Python using pip so as to be able to import MySQLdb in Django 3.1 when running Python 3.8.5..
The error message indicates that there is no module named MySQLdb. It means, Python needs a module to interface with MySQL database and that modules does not seems to be present in the system. All you need to do is, just install MySQL-Python module and the script should work without any problem.
Using Python Pip
pip install MySQL-python
Collecting MySQL-python
Installing collected packages: MySQL-python
Running setup.py install for MySQL-python
Successfully installed MySQL-python-1.2.5
On Ubuntu based systems
# apt-get install python-mysqldb
On RHEL/CentOS based systems:
# yum install MySQL-python
Using easy_install
# easy_install mysql-python
If you are on a virtual environment then
pip install MySQL-python
You can also check this related issue.
** Building wheel for MySQL-python (setup.py) ... error
ERROR: Command errored out with exit status 1:**
can't able to install MySQL-python and getting the above error .
I've read the many posts on SO regarding using Pillow or Image instead of PIL but I'm still having trouble with this module.
I'm running this on my MBP on 10.9.5.
I used pip to install image 1.5.5 and Pillow 3.4.2. However, when I go to import the module in my script, it keeps saying there's no module of that name.
first.last#localhost:/usr/local/bin> pip freeze | grep Pillow
Pillow==3.4.2
first.last#localhost:/usr/local/bin> pip freeze | grep image
image==1.5.5
first.last#localhost:/usr/local/bin> which pip
/usr/local/bin/pip
first.last#localhost:/usr/local/bin> which python
/usr/local/bin/python
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named image
>>> import PIL
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PIL
>>> import Pillow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Pillow
>>> import pillow
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pillow
I checked /Library/Python/2.7/site-packages and it doesn't seem like the .py files are there for pillow or image, even though pip freeze showed that image and Pillow are both installed.
This is the contents of pip is this. Not sure if it gives any clues to why pip thinks the modules are installed but python says it can't find it.
#!/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
# EASY-INSTALL-ENTRY-SCRIPT: 'pip==9.0.1','console_scripts','pip'
__requires__ = 'pip==9.0.1'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('pip==9.0.1', 'console_scripts', 'pip')()
)
From what I showed in my setup/environment, can anyone point me in a general direction to start fixing this problem? Is any additional information needed to debug this some more?
Since you are working outside of a virtualenv, the user site should be enabled. Use the following commands to find the installed location of image and/or pillow:
pip show -f image | grep Location
pip show -f pillow | grep Location
What you probably want to see is something like:
Location: /Users/<your_username>/.local/lib/python2.7/site-packages
If it's not installing there, then uninstall and pip install again with the --user flag.
Then use the following command to make sure that the results of above will be found in your path:
python -m site
What you want to see in the output is something like
sys.path = [
...
]
USER_BASE: '/Users/<your_username>/.local' (exists)
USER_SITE: '/Users/<your_username>/.local/lib/python2.7/site-packages' (exists)
ENABLE_USER_SITE: True
If the installed location is in your user site, and your user site is enabled, then the import will work.
I am trying to install the mysqldb module in my python2.7 ubuntu. I am using the following ways to install
$ tar -xvf MySQL-python-1.2.2.tar
$ cd MySQL-python-1.2.2
$ sudo python setup.py build
$ sudo python setup.py install
then i am going to import the module. It shows the following error.
import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb
I have also tried to install by using apt-get and pip. there is no way it shows the same above import error. Could you please help me? thanks in advance.
Installed all the dependencies for juju
pip install pyparsing==1.5.7
pip install pyOpenSSL PyYAML txaws pydot oauth txzookeeper zc-zookeeper-static
pip install juju
All installed fine but when I start juju, fails with the following error:
(jujuapp) ± juju
Traceback (most recent call last):
File "/Users/millisami/.virtualenvs/jujuapp/bin/juju", line 4, in <module>
from juju.control import main
File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/control/__init__.py", line 7, in <module>
from .utils import ParseError
File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/control/utils.py", line 8, in <module>
from juju.state.environment import EnvironmentStateManager
File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/state/environment.py", line 8, in <module>
from juju.environment.config import EnvironmentsConfig
File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/environment/config.py", line 8, in <module>
from juju.lib import serializer
File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/lib/serializer.py", line 1, in <module>
from yaml import CSafeLoader, CSafeDumper, Mark
ImportError: cannot import name CSafeLoader
What is this error?
I'm on Mac 10.6, python and pip installed via homebrew.
I just ran into this issue on 10.8; juju uses the libyaml bindings in PyYaml, so it needs to have PyYaml installed --with-libyaml, which requires more than that on the mac. Here's how I got it working:
brew install libyaml with homebrew
Download PyYaml source (instructions)
Now modify [pyyaml-install-dir]/setup.cfg like this:
# List of directories to search for 'yaml.h' (separated by ':').
include_dirs=/usr/local/Cellar/libyaml/0.1.4/include/
# List of directories to search for 'libyaml.a' (separated by ':').
library_dirs=/usr/local/Cellar/libyaml/0.1.4/lib/
So it can find your homebrew installation of libyaml. Then you also need to install Cython..
sudo pip install cython
and finally..
sudo python setup.py --with-libyaml install (in the PyYaml dir)
Now juju should work!