conda update causes ImportError: No module named tqdm
Question:
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)
Answers:
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.
I ended up removing and reinstalling anaconda, which fixed the problem.
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>
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)
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.
I ended up removing and reinstalling anaconda, which fixed the problem.
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>