import mysql.connector got the following error.
import mysql.connector
ModuleNotFoundError: No module named 'mysql'
However, the following commands show the mysql is installed?
(env) bash-4.2$ pip list | grep mysql
mysql (0.0.3)
mysqlclient (2.0.3)
(env) bash-4.2$ conda list mysql
WARNING conda.core.prefix_data:_load_site_packages(272): Problem reading non-conda package record at lib/python3.6/site-packages/pyzmq-17.0.0-py3.6.egg-info/PKG-INFO. Please verify that you still need this, and if so, that this is still installed correctly. Reinstalling this package may help.
WARNING conda.core.prefix_data:_load_site_packages(272): Problem reading non-conda package record at lib/python3.6/site-packages/jupyterlab-2.3.1-py3.9.egg-info/PKG-INFO. Please verify that you still need this, and if so, that this is still installed correctly. Reinstalling this package may help.
WARNING conda.core.prefix_data:_load_site_packages(272): Problem reading non-conda package record at lib/python3.6/site-packages/conda-4.10.3-py3.6.egg-info/PKG-INFO. Please verify that you still need this, and if so, that this is still installed correctly. Reinstalling this package may help.
WARNING conda.core.prefix_data:_load_site_packages(272): Problem reading non-conda package record at lib/python3.6/site-packages/certifi-2021.5.30-py3.6.egg-info/PKG-INFO. Please verify that you still need this, and if so, that this is still installed correctly. Reinstalling this package may help.
# packages in environment at /apps/external/4/anaconda3:
#
# Name Version Build Channel
mysql 5.7.20 h55eaa98_0 https://mycompany.intranet/repository/anaconda-main-proxy
BTW, why the version of pip mysql is so low? (0.0.3)
pip install mysql-connector
or
Do not make your .py file name: mysql.py or something like that.
OS: Mac 11.6.2 (Big Sur)
Python: 3.9.7
If you, like me, use conda environments, and you have trouble installing the mysql-connector-python module with an existing mysql module installed, try this:
(env)username ~% conda update --all
(env)username ~% conda uninstall mysql
(env)username ~% conda install -c conda-forge mysql
(env)username ~% conda install -c conda-forge mysql-connector-python
Now the mysql.connector package is found from the JupyterLab notebook when running it from either VSCode or from Anaconda Navigator.
I hope this is useful for someone.
Related
I just upgraded Anaconda and Spyder to the latest version (Spyder 5.1.5), but since that I get an error message every time I start Spyder:
However, I have tried to install and update paramiko with both conda install paramiko and conda update paramiko, which appears to be of version 2.8.1 (this is the output from conda list about paramiko:
paramiko 2.8.1 pyhd3eb1b0_0
I'm not sure if I even use this package, but I would be much happier if I didn't get this error message upon Spyder startup.
Try:
conda update paramiko
If it does not work:
pip uninstall paramiko
pip install pyqt5==5.12
pip install pyqtwebengine==5.12
pip install paramiko==2.4.0
This works for me. Hope it helps!
Thanks!
I found that the problem is caused by the "DLL load failed while importing _openssl" (you can try import paramiko in ipython kernel to see the errors), so you can go to the website https://slproweb.com/products/Win32OpenSSL.html to download openssl for your computer according to the system. After installation, try import paramiko again, and you'll find no errors this time. Then restart spyder you'll get the problem fixed.
Firstly, I'm super new to Python/code and stackoverflow, so apologies if I sound like a child trying to explain complex rocket science.
I'm following a tutorial on creating a fake teachers database, and they say
import mysql.connector
from mysql.connector import Error
import panda
however, when I go to import, I get an error of
ImportError: Unable to import required dependencies:
pytz: No module named 'pytz'
dateutil: No module named 'dateutil'
Despite the modules being imported and in the Python folder. It took me around 30 minutes to get MySQL imported, and honestly I'm not even really sure how it fixed. I renamed the folder, I copied the folder into the virtual environment I'm using (which I'm not even sure how to not use that, it seems to just create difficulties in doing any importing), I had to reinstall pip multiple times as it also error'd the first 2 tries. I'm really confused and a little frustrated as I have zero idea how to fix this, or what even the errors are in the first place.
Any help would be much appreciated!!
Pip should be included with your Python installation. Try pip install mysql and pip install panda. If that doesn't work try py -m pip install mysql and py -m pip install panda.
Try:
pip3 install mysql pytz
You can install multiple packages at the same time!
If you want to get out of the virtual environment you created you can use the deactivate command.
See If pip is installed in your system
If its Installed , Install pytz by exeuting
pip install pytz
Install Pip = https://bootstrap.pypa.io/get-pip.py
Just download and run this file
following code is giving me error.
import pandas as pd
df = pd.DataFrame({'a' : [1,2,3]})
df.to_hdf('temp.h5', key='df', mode='w')
This is giving me error.
Missing optional dependency 'tables'. Use pip or conda to install tables.
I already tried
ImportError HDFStore requires PyTables No module named tables. Still the same error.
I am getting the same error when reading hdf file. And tables are already installed for my python.
Some version info.
python 3.7.4
pandas 0.25.2
windows10
PS: You can reproduce this in repl https://repl.it/.
Update:
I tried runnig following.
import tables
and got this error:
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path.
It looks like pandas is not giving accurate message for this. Its just saying missing dependency when its actually present.
If anyone knows how to resolve this. That will help.
For conda users:
conda install pytables
The issue was with tables.
When i was installing tables using pip into local user directory using following command it's not working.
pip install --user tables
Running import tables will result in this error.
ImportError: Could not load any of ['hdf5.dll', 'hdf5dll.dll'], please ensure that it can be found in the system path
The solution that worked for me is to uninstall tables. And install it into python's directory. (or where your python is installed). without --user option. You may require admin/root access for this depending upon location of your python.
For me my python path was C:\Program Files\Python37-64\python.exe and installing under c:\program files\python37-64\lib\site-packages\ worked for me.
Hope this helps. I don't know why installing in user directory is not working for tables. If anyone can find the reason for that please post here.
I got it to work by using
conda install snappy
using tables 3.6.1 worked for me to resolve the dependency
pip install tables==3.6.1
I used following command successfully resolved this problem:
pip install --upgrade tables
hope that work for you !
This problem has appeared for me when refreshing an existing conda virtal env using pip install -U -r requirements.txt. I resolved the issue as follows:
conda env remove -n <env> # remove your virtual env.
conda create -n <env> python==3.8 # create your virtual env again.
pip install -U -r requirements.txt
It's quite tedius to maintain a mix of conda and pip packages, so I just use the latter.
The above solutions did not work for me. Perhaps because I built the individual environment using the conda-forge channel, I had success with this:
conda install -c conda-forge pytables
I need to connect to Oracle database in Python Anaconda3-2.5.0-Windows-x86_64. Installation of the cx_Oracle module by:
conda install -c https://conda.anaconda.org/anaconda cx_oracle
fails with following output (trimmed):
Hint: the following packages conflict with each other:
- cx_oracle
- python 3.5*
So I tried to install package for Python 3.5 by 'cx_Oracle-5.2.1-11g.win-amd64-py3.5.exe' from https://pypi.python.org/pypi/cx_Oracle/ Which seems to be working (somehow). Even 'conda list' command prints line:
cx-oracle 5.2.1 <pip>
But when I enter import cx_Oracle; in Python then
ImportError: DLL load failed: Uvedený modul nebyl nalezen.
appears. Rough translation of last localized part is 'Modul not found.'
How can I install the cx_Oracle module? Or is there any other way to connect to Oracle database?
I'm assuming that you have windows and python 3.5 only installed. Check your anaconda just incase to make sure you are using anaconda3 or that anaconda is setup with python3 environment. Assuming all that checks out and you are still getting that same error try doing a fresh install of cx_oracle from pip.
On your windows machine open up cmd and type pip install cx_Oracle and it should install nicely. If you by chance have python2 installed as well you might want to do python3 -m pip install cx_Oracle. After installation completes you should be good to go.
In the Anaconda navigator, select 'Environments', then on the right, change the filter to 'All'. Now you can query for 'cx_oracle', select it and at the bottom, select 'Apply'. Once completed, you should be able to
import oracle
Download a precompiled version of the package and install it using easy_install.
Easier way to load is to down load from the below link
https://pypi.python.org/pypi/cx_Oracle/
and install it in Windows. It worked like a charm for me.
From https://anaconda.org/anaconda/cx_oracle
conda install -c anaconda cx_oracle
I installed anaconda a little while ago. Later I installed django. Django was the first program I could install successfully and run without error.
I just tried to install mysqldb with the following:
sudo apt-get install python-mysqldb
and it gave following message:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-mysqldb is already the newest version.
The following packages were automatically installed and are no longer required:
linux-headers-3.5.0-17 linux-headers-3.5.0-17-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
If I run a django app configure to have a mysql back-end I get
ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
I think this has something to do with having anaconda installed. I'm running on ubuntu OS.
Does anyone know how I can get mysqldb module to get recognized by django?
It looks like all my anaconda modules are in:
/home/aiden/anaconda/lib/python2.7
I think my django lives in:
/home/aiden/django/
and i searched for mysqldb and found a file under anaconda:
/home/aiden/anaconda/lib/python2.7/site-packages/sqlalchemy/something.../drizzle/mysqldb.py
I don't know how to check where I installed things to, but I think that mysqldb isn't getting installed b/c it's already somewhere in anaconda
apt-get is going to install things into the system Python. To install things into Anaconda, you need to use the conda package manager, assuming the package is build for conda already, or else build from source. You can also try to find the package on binstar.org if there isn't one in conda already.
I just ran a "conda install bottle" but it didn't have the package available, but it automatically installed bottle using pip. This works fine. Anaconda is great.