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.
As the Anaconda Distribution of Spyder has some typing latency issues on macOS Big Sur, I've gone ahead and downloaded the standalone distribution. However, when trying to install packages with pip I get the error message:
pip install numpy
/Applications/Spyder.app/Contents/MacOS/python: No module named pip
Note: you may need to restart the kernel to use updated packages.
(I know that NumPy is already installed - this just serves as an example). I have Anaconda installed, and there pip works fine. How do I install it for the specific Standalone Distribution?
I solved this problem using the Command Prompt and typing pip install -U spyder. If you don't have the "standalone version" of Python, just install it to have access to this command.
After that, you can simply open Spyder typing in the Command Prompt spyder.
I installed tensorflow on my mac and now I can't seem to open anaconda-navigator. When I launch the app, it appears in the dock but disappears quickly. When I launch anaconda-navigator the terminal I get the following error(s).
KeyError: 'pip._vendor.urllib3.contrib'
I once had the same issue and fixed it by deleting the system pip cache.
Check https://github.com/pypa/pip/issues/5079 for more info.
I fixed the issue by downgrading to pip version 9.0.1. It appears anaconda doesn't like pip version 9.0.2 I ran: pip install pip==9.0.1
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
Tab completion on IPython seems not to be working. For example,
import numpy
numpy.<tab>
simply adds a tab.
import numpy
num<tab>
just adds a tab, too. Could you please suggest some possible causes for this problem? I am running Windows 7 and Python 2.6.5.
Be sure you have installed the pyreadline library. It is needed for tab completion and other IPython functions - in Windows it doesn't come with the IPython package and you have to install it separately -
> pip install pyreadline
In case anyone is using the recent 7.19.0 and autocomplete does not work, try downgrading jedi to 0.17.2:
pip install jedi==0.17.2
See https://github.com/ipython/ipython/issues/12740 for details.
pip uninstall jedi --yes
and
pip install pyreadline
The current Ipython with the Jupyter notebook doesn't require jedi.. So you have to just uninstall it with the above command.
I got it from here.
pip told me I had pyreadline version 1.7.1 installed
C:\Users\me>pip freeze | grep readline
pyreadline==1.7.1
Upgrading pyreadline fixed it for me:
C:\Users\me>pip install --upgrade pyreadline
C:\Users\me>pip freeze | grep readline
pyreadline==2.0
Your ipythonrc file may be out of date.
Try running
ipython -upgrade
Downgrading iPython did the trick.
pip install --upgrade ipython==5.8.0
I had this problem.
I solved by downgrade the python-parso package
downgrading the python-parso package (0.8.0-1 => 0.6.2-1)
This should definitely work as it worked in my case
conda install ipython
pip install jedi==0.17.2
The classic 'have you tried turning it off and on again' worked for me.
pip uninstall ipython
pip install ipython
As of right now, on a OSX, pip installed ipython doesn't give tab completion, pyreadline release.py is busted .. what WFM:
easy_install ipython readline
YMMV.
Someone else in StackOverflow posted this link: http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/
Its basicly easy_install readline than discover where the readline egg got installed and edit the ipython bin script to use this readline:
Install the "official" readline: easy_install readline
Discover where it is. Look at /Library/Python/site-packages/readline-*.egg or in your Virtualenv counterpart
Discover where ipython bin is: which ipython
Add ONE LINE to this file, adding the readline egg path right after import sys line.
My virtualenved ipython bin script got working as follow:
#!/Users/alanjds/src/git/cervejeiras/venv/cervejeiras-lfs/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'ipython==0.13.1','console_scripts','ipython'
__requires__ = 'ipython==0.13.1'
import sys
### ONLY LINE ADDED:
sys.path.insert(0, '/Users/alanjds/src/git/cervejeiras/venv/cervejeiras-lfs/lib/python2.6/site-packages/readline-6.2.4.1-py2.6-macosx-10.6-fat.egg')
####
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('ipython==0.13.1', 'console_scripts', 'ipython')()
)
I realize this is a really old question, but none of the answers above worked for me (And this is the first hit you get when you google a question of this nature).
I should mention that this is NOT exclusive to windows, I had the problem running CentOS 6.5 and Python 2.7
Here is what I did:
apt-get/yum install ncurses-devel
#If you want history in iPython:
apt-get/yum install sqlite-devel
easy_install ipython readline
ipython
In [1]: from
Display all 391 possibilities? (y or n)
If you don't have the -devel packages, your install will fail when it comes time to link them and build the eggs.. Hope this helps others!
I had this problem and knew that I had the pip installed for the module I was looking for. Performing $ ipython --init solved the problem for me.
I had to mv ~/.ipython{,.bak} in my case.
If you use Jupyter notebook and you still did get Tab auto-complete working after you tried all the steps suggested in the post here, you might want to check if you are trying to use the Tab auto-completion within a function definition. Ifyour import statements are part of the function such as below, you will not get the Tab auto-completion. You need to put the import statements outside the function and also execute them once before asking for auto-completion on the packages.
def myfunction():
import pandas as pd
import numpy as np
a = pd.DataFrame(np.random.normal(1,3, (4,4))
return a
I faced the same problem with the numpy library. The issue is with the particular version of ipython or jupyter notebook and it is resolved by simply updating ipython or jupyter.
If you are using a conda environment like anaconda or miniconda then update ipython in that environment by using
conda update ipython
In case of anaconda you also need to update the qtconsole
conda update qtconsole
Sometimes anaconda constraints the update of ipython then try
conda update -all
If you are not using a environment then directly update using pip
pip update ipython
I solved my issue by installing jedi-language-server:
pip install -U jedi-language-server
PS, I was installed Ipython from Conda in a virtual env and used the above command when the env was activated.
To check if ipython and the modules it uses match, run pip check ipython.
For my configuration with ipython 7.25 in July 2021, this gave a good clear warning:
ipykernel 6.0.1 has requirement importlib-metadata<4; python_version < "3.8.0", but you have importlib-metadata 4.6.0.
You may of course see different warnings --
this is just an example, unrelated to tab completion.
Then to downgrade it, e.g.
pip install 'importlib-metadata<4' # don't forget the 'quotes'
Successfully uninstalled importlib-metadata-4.6.0
Successfully installed importlib-metadata-3.10.1
Also useful:
pip list -- everything in your $PYTHONPATH, with version and location
pip check -- everything
pip show ipython --
Requires: traitlets, pygments, jedi, decorator, pickleshare, pexpect, appnope, matplotlib-inline, setuptools, prompt-toolkit, backcall
but to see the required versions you have to look at
.../site-packages/ipython-*.dist-info/METADATA
Pyreadline is needed by ipython. Install pyreadline. This was done in Windows 7. Get pyreadline zip, pyreadline-master.zip, unzip. In powershell change directory into uzipped pyreadline, make sure python is set in Path, and enter commandpython setup.py install This will intall pyreadline in C:\Python27\Lib\site-packages