$pip command gets ImportError: No module named typing - python

When I am trying to run the following command:
$ pip
I get:
Traceback (most recent call last):
File "/usr/bin/pip", line 9, in <module>
from pip import main
File "/home/ssm-user/.local/lib/python2.7/site-packages/pip/__init__.py", line 1, in <module>
from typing import List, Optional
ImportError: No module named typing
Does anyone knows how to solve the issue? Thanks!
Here are my python versions:
$ python2 -V
Python 2.7.12
$ python3 -V
Python 3.5.2

Turns out the issue is the same as this. I followed the solution and downgraded pip and that solves the issue.

Related

Pip installation on Linux broke

I tried to instlall Python3-pip on my Linux Debian 8 Server with following command: sudo apt install python3-pip. That worked fine without any problem.
But if I'm checking now the Version of this pip3 module, I get follwing error:
$ pip3 --version
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip._internal.cli.main import main
File "/usr/local/lib/python3.4/dist-packages/pip/__init__.py", line 1, in <module>
from typing import List, Optional
ImportError: cannot import name 'List'
I tried to somehow solve this problem, but did not get any solution up to now...
Does anybody have had a similar Problem?

PyTouchBar: no module named Foundation

I installed PyTouchBar using pip3
When I tried to import it, however, it gives me this error.
$ python3
>>> import PyTouchBar
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyTouchBar/__init__.py", line 5, in <module>
from .TouchBar import *
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyTouchBar/TouchBar.py", line 13, in <module>
from Foundation import *
ModuleNotFoundError: No module named 'Foundation'
On Python 2, Foundation works perfectly, by the way.
Could someone tell me how to fix this? Thanks in advance!
I think your problem could be one of these:
You installed PyTouchBar on python2 instead of python3, in which case you have to use:
pip3 install PyTouchBar
You are using a venv and installed from the terminal/command line instead of the venv's terminal
PyTouchBar uses foundation that you have to install separately

"RuntimeError: implement_array_function method already has a docstring", trying to import numpy. How do I solve this?

I am trying to run a script importing numpy, and it shows this error:
Traceback (most recent call last):
File "C:/Users/<user>/pycharm/<my_project>/../examples/<my_file>.py", line 5, in <module>
import numpy as np
File "C:\Users\<user>\pycharm\<myproject>\lib\site-packages\numpy\__init__.py", line 142, in <module>
from . import core
File "C:\Users\<user>\pycharm\<myproject>\lib\site-packages\numpy\core\__init__.py", line 24, in <module>
from . import multiarray
File "C:\Users\<user>\pycharm\<myproject>\lib\site-packages\numpy\core\multiarray.py", line 14, in <module>
from . import overrides
File "C:\Users\<user>\pycharm\<myproject>\lib\site-packages\numpy\core\overrides.py", line 47, in <module>
""")
RuntimeError: implement_array_function method already has a docstring
Process finished with exit code 1
I googeled and my results are
that it might have to do with importing numpy multiple times and
that it might be related to some software called usgwi that python may run under.
I am using python 3.7 and numpy 1.18.5.
Thank you!
I think issue with numpy.
See https://github.com/numpy/numpy/issues/14384
I had issue in VSCode using python AREPEL. I fixed with:
python3 -m pip install --user numpy -U
$ python3 -m pip freeze | grep numpy
numpy==1.19.4
$ python3 --version
Python 3.8.6
Downgrading numpy to numpy==1.15.4 will solve this issue.
pip install --no-cache-dir -I numpy==1.15.4

ModuleNotFoundError: No module named 'future'

I have a Python script that I am trying to run in Linux via a bash script called ./launch.sh. When I launch the code I get the following error returned.
[user#localhost mktdata.out]$ ./launch.sh
[user#localhost mktdata.out]$ Traceback (most recent call last):
File "strats/merlin.py", line 10, in <module>
File "strats/merlin/mktdata.py", line 11, in <module>
File "strats/dao/utils/itertools.py", line 1, in <module>
ModuleNotFoundError: No module named 'future'
Line 1 in the Python script itertools.py line 1 that the error is referring to is:
from future.moves.itertools import zip_longest
Is there a package that I need to install in order for this code to work?
You need to import future like this:
from __future__ import *
In the event that fails, use pip to install it like this (Use sudo for MAC):
pip install future
Here is more on installing future.

ImportError: No module named pkg_resources after I upgrade python from 2.6.6 to 2.7.3

When I run pip install xxx or easy_install xxx, I met this problem after upgrading Python from 2.6.6 to 2.7.3:
Traceback (most recent call last):
File "/usr/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
Could someone give me some advice ?
first try to run python26 or python27 to see what happening.
check if setting PYTHONPATH in shell.
unset it!
or set it
PYTHONPATH=/usr/lib/python2.7:/usr/lib/python2.7/site-packages/

Categories