conda update causes ImportError: No module named tqdm - python

Whenever I try to update anything using conda, I get an error: ImportError: No module named tqdm. Here's the full traceback:
$ conda update conda
Traceback (most recent call last):
File "/Users/user/anaconda2/bin/conda", line 13, in <module>
sys.exit(main())
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/cli/main.py", line 150, in main
return conda_exception_handler(_main, *args, **kwargs)
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1335, in conda_exception_handler
return_value = exception_handler(func, *args, **kwargs)
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1046, in __call__
return self.handle_exception(exc_val, exc_tb)
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1090, in handle_exception
return self.handle_unexpected_exception(exc_val, exc_tb)
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1101, in handle_unexpected_exception
self.print_unexpected_error_report(error_report)
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/exceptions.py", line 1171, in print_unexpected_error_report
from .cli.main_info import get_env_vars_str, get_main_info_str
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/cli/main_info.py", line 19, in <module>
from ..core.index import _supplement_index_with_system
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/core/index.py", line 9, in <module>
from .package_cache_data import PackageCacheData
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda/core/package_cache_data.py", line 15, in <module>
from conda_package_handling.api import InvalidArchiveError
File "/Users/user/anaconda2/lib/python2.7/site-packages/conda_package_handling/api.py", line 5, in <module>
import tqdm
ImportError: No module named tqdm
However, when I try to install tqdm with pip, it says it is already installed:
$ pip install tqdm
Requirement already satisfied: tqdm in /usr/local/lib/python2.7/site-packages (4.32.2)
I am using Python 2.7 on MacOS Mojave with no virtual environments. How can I fix conda?
EDIT:
I also tried: python -m pip install tqdm but it says requirement already satisfied.
Then I tried: /Users/user/anaconda2/bin/python -m pip install tqdm but it also says requirement already satisfied: Requirement already satisfied: tqdm in ./anaconda2/lib/python2.7/site-packages (4.31.1)

I ended up removing and reinstalling anaconda, which fixed the problem.

If you cannot use conda to install tqdm, something is seriously messed up.
In the best of cases, it's only about environment variables. Are you setting PYTHONPATH or similar? That could interfere with conda finding its own packages.
Check your environment variables, don't set anything Python.
Execute conda activate base.
Check that python now is the one from the conda base environment.
Call conda install.
In the worst of cases, you somehow uninstalled or broke a package that conda needs. In this case, re-install Miniconda from scratch in a different directory. You should use Miniconda3 (or Anaconda3) this time, as Python 2 is only half a year away from its end of life.
Afaik, conda is able to mange existing environments from a previous installation, but I've never tried to use that feature.
If you haven't been using conda environments, but installed everything into the conda base environment, and that environment is messed up, I have no idea how to recover. You should always create custom conda environments for your projects.

for ubuntu 18.04
i faced the same issue on jupyter notebook, however the current apt install builds the 4.19 as latest which was bugged out for me.
Here are my steps for the solution:
Download the desired newer version
http://old-releases.ubuntu.com/ubuntu/pool/universe/t/tqdm/
cd to deb file location
sudo dpkg -i <filename.deb>

Related

Spyder is not launching from Anaconda Navigator, on Windows

While launching Spyder from Anaconda Navigator or directly from the menu, it is showing the given error message:
Traceback (most recent call last):
File "C:\Users\charchil\anaconda3\Scripts\spyder-script.py", line 6, in
from spyder.app.start import main
File "C:\Users\charchil\anaconda3\lib\site-packages\spyder\app\start.py", line 22, in
import zmq
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq_init_.py", line 47, in
from zmq import backend
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend_init_.py", line 40, in
reraise(*exc_info)
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\utils\sixcerpt.py", line 34, in
reraise raise value
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend_init_.py", line 27, in
ns = select_backend(first)
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend\select.py", line 28, in
select_backend mod = import(name, fromlist=public_api)
File "C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython_init.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from 'zmq.backend.cython' (C:\Users\charchil\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython_init_.py)
A similar issue was raised on Jupyter Notebooks GitHub so it seems likely that a similar solution will help you, i.e.:
Attempt:
conda uninstall pyzmq
conda install pyzmq
Using the conda packages should make sure that version compatibility is maintained. If, however, that still doesn't work (and some comments in the attached issue suggested that it didn't work for some people), attempt:
pip uninstall pyzmq
pip install pyzmq
You can check your version of pip with pip --version and might want to consider upgrading it first if it is a long way behind. Current version is 20.1.1. Command to upgrade pip is:
python -m pip install --upgrade pip
Open the Anaconda prompt
conda deactivate
conda update anaconda-navigator
https://docs.anaconda.com/anaconda/navigator/update-navigator/
For those who are still looking for a quicker answer then below solution might help you as well and this worked for me like a charm.
Open Anaconda Prompt
Run the command conda update --all
Re launch the Anaconda Navigator now
Now Launch, spyder or jupyter notebook. Probably it should work for you as well.
NOTE: If you are running any firewall application then, make sure you launch navigator in administrator mode and unblock any prompt requests accordingly for smooth launching. This is on windows systems again and may be a different way for other platforms.
Hope this helps someone in need again. All the best.

pip3 ImportError: cannot import name 'IncompleteRead'

Having trouble installing modules via pip3, tried several suggestions from top voted thread from Dec' 2014, but still getting the following:
sudo pip3 install send2trash
Traceback (most recent call last):
File "/usr/bin/pip3", line 9, in <module>
load_entry_point('pip==1.5.6', 'console_scripts', 'pip3')()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/usr/lib/python3/dist-packages/pip/__init__.py", line 74, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/usr/lib/python3/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
from pip.download import path_to_url
File "/usr/lib/python3/dist-packages/pip/download.py", line 25, in <module>
from requests.compat import IncompleteRead
ImportError: cannot import name 'IncompleteRead'
On Ubuntu 15.10; tried removing python 3 completely and reinstalling, still having issues. Help?
Edit: UPDATE: Tried using my bootable USB to repair Ubuntu and get back to original config and reinstalled via sudo apt-get install python3-pip, but now it generates a crash report saying:
Sorry, the application pip3 has unexpectedly crashed.
This seems to be an issue with pip's interaction with the requests package. requests dropped the IncompleteRead module but older versions of pip, which you have, still rely on it, newer versions don't.
You should try updating pip via easy_install-3.5 (if you have Python 3.5) or easy_install-3 for other versions:
sudo easy_install-3.5 -U pip
or:
sudo easy_install-3 -U pip
and you should be good to go.
Had similar error on Raspberry Pi. The solution was a combination of all proposals above:
sudo pip install --upgrade pip
sudo pip install --upgrade requests
sudo easy_install3 -U pip
It happened me when I tried to install a pip module to my Python3 installation. I mistakenly run pip instead of pip3 and it installed Python2 modules into Python3 installation. After that I realized command was wrong, I run pip3 this time. But, it was no good, installation was blown up, there were errors in Python2 like parenthesis missing in print statement(obviously this is an error for Python3). Eventually, it blown up my terminal too, I needed to install another terminal.
Like you did, I tried to install and reinstall everything, but it didn't work. Fix needed to be done manually. After trying several days and failing, I backed up my files and reinstalled Ubuntu.
I know this is not what you want, but maybe you can save your time by accepting that reinstalling the OS is the easiest solution.
Make sure you install newest versions of pip and requests:
pip install --upgrade pip
pip install --upgrade requests

Error using pelican-quickstart "No module named html_parser"

I decided to give pelican a try, but when I run pelican-quickstart, I get the following dialog:
$ pelican-quickstart
Traceback (most recent call last):
File "/usr/local/bin/pelican-quickstart", line 9, in <module>
load_entry_point('pelican==3.4.0', 'console_scripts', 'pelican-quickstart')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 357, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2394, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2108, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/__init__.py", line 20, in <module>
from pelican.generators import (ArticlesGenerator, PagesGenerator,
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/generators.py", line 23, in <module>
from pelican.readers import Readers
File "/Library/Python/2.7/site-packages/pelican-3.4.0-py2.7.egg/pelican/readers.py", line 24, in <module>
from six.moves.html_parser import HTMLParser
ImportError: No module named html_parser `
There was a similar error message in this post, and since I'm running Python 2.7.6 on OS X 10.10 (Yosemite), there may be a similar issue.
What's the best way to address this?
Reinstall Pelican doesn't help me, so I made a little fix in pelican
Modifications were made in following file
/Library/Python/2.7/site-packages/pelican/readers.py
at line 24 place
from six.moves import html_parser
instead of
from six.moves.html_parser import HTMLParser
and at line 299
class _HTMLParser(html_parser.HTMLParser):
instead of
class _HTMLParser(HTMLParser):
Modification actual for pelican 3.6.0, but seems to applicable for other version if search for this lines in readers.py file. This is just quick workaround, hope this problem will be solved at pelican's side.
This error seems to come from Python 2.7.6 on OSX. When I install python via Homebrew and reinstall this module I got rid of this error.
$ pip uninstall pelican
$ brew install python
$ which python # should show /usr/local/bin/python
$ python -V # should show Python 2.7.8
$ pip install pelican
I think that you've probably encountered with version conflict problem in module six.
Try sudo pip install virtualenv to create an isolate python environment.
start
create your pelican path mkdir /path/to/pelican
go to /path/to/pelican and create an isolate python environment with virtualenv venv
activate virtualenv source venv/bin/activate
install pelican under the venv(without sudo!) pip install pelican markdown
done
and now you are free to any problem mentioned above. all the dependencies in the venv are isolated from the global environment.
To quit the venv, type deactivate
I was running into the same error message.
six was also already installed, but an old version (1.4.1)
pip install six --upgrade
Installed six 1.10.0, which made pelican-quickstart finally work :)
You may need to install six.
if you're using pip, try
pip install six
and then restart pelican-quickstart

Can't find "six", but it's installed

I have six installed (even reinstalled it).
$ pip show six
---
Name: six
Version: 1.7.3
Location: /usr/lib/python2.6/site-packages
Requires:
But when I try to run csvcut, it can't find it.
$ csvcut -n monster.csv
Traceback (most recent call last):
File "/usr/bin/csvcut", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 2655, in <module>
working_set.require(__requires__)
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 648, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python2.6/site-packages/pkg_resources.py", line 546, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: six>=1.6.1
Here's the relevant but of csvcut:
#!/usr/bin/python
# EASY-INSTALL-ENTRY-SCRIPT: 'csvkit==0.8.0','console_scripts','csvcut'
__requires__ = 'csvkit==0.8.0'
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.exit(
load_entry_point('csvkit==0.8.0', 'console_scripts', 'csvcut')()
)
This is on CentOS.
Uninstalling and reinstalling six using pip didn't work
sudo pip uninstall six
sudo pip install six
However, I was able to solve the problem using easy_install:
easy_install --upgrade six
Reason for this is when you install Six using PIP the location of the Six library isnt added to Pythons Path so when trying to use the commands, python cant find them. Installing with Easy_Install doesn't have this problem, when it is installing six it automatically updates the python path variable so python can find the library.
Installing by Easy_Install as answered before resolves this but you can alternatively add the location to the python path variable.
I came across the same problem today, reinstalling with pip did not work and i can not do it with easy_install as it a custom package
the solution was to point the PYTHONPATH variable to the site-packages that contains the package
export PYTHONPATH=$PYTHONPATH:/path/to/sites-package
you will face this problem if you work with virtual env

Unable to find virtualenv or django after installing with pip

I installed virtualenv using pip and now receive the following error whenever I actually try and use it:
% virtualenv
Traceback (most recent call last):
File "/bin/virtualenv", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 2705, in <module>
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 668, in require
File "build/bdist.macosx-10.9-x86_64/egg/pkg_resources.py", line 571, in resolve
pkg_resources.DistributionNotFound: virtualenv==1.11.2
%
Similarly, I installed django with pip, and when I try and import django in python I get: ImportError: No module named django.
I tried to install virtualenv again, this time using easy_install instead of pip. easy_install gave me an error saying that it was having issues with my PYTHONPATH environment variable. Lo and behold, after reading http://www.stereoplex.com/blog/understanding-imports-and-pythonpath, PYTHONPATH is what python uses to find modules, and my PYTHONPATH was unset.
After setting PYTHONPATH to /lib/python3.3/site-packages (where pip was installing my modules), both virtualenv and importing django functioned properly.
Note: because I have both python2.7 and python 3.3 installed, for me pip actually installs packages to /lib/python2.7/site-packages while pip3 installs packages to the aforementioned /lib/python3.3/site-packages.
For the unfamiliar, information on setting environment variables can be found here: https://help.ubuntu.com/community/EnvironmentVariables

Categories