Cannot import Python Libraries anywhere

Issue on importing Python Library

Background

  • I am on MacOS 10.14.5.
  • I currently cannot import any Python third-party Library from anywhere (including VSCode, Pycharm and terminal).

Detail

  • For example, I have been using pip3 install pandas to download the Python Library:

pip3 list

Package Version
----------------- --------
astroid 2.2.5
beautifulsoup4 4.7.1
certifi 2019.3.9
chardet 3.0.4
idna 2.8
isort 4.3.16
lazy-object-proxy 1.3.1
mccabe 0.6.1
numpy 1.16.4
panda 0.3.1
pandas 0.25.0 
  • However, I just cannot import it:

python3

Python 3.7.2 (v3.7.2:9a3ffc0492, Dec 24 2018, 02:44:43)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last): File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas
  • (Same problem exists in any other editor)

  • Also, when I am trying to install Libraries by Pycharm, it reports:

    Collecting pandas

    Could not install packages due to an EnvironmentError: Missing dependencies for SOCKS support.

  • However, even after turning off the proxy, the problem still exists.


If there is any other operations needed for diagnosis, please tell me! Thanks for helping!

1 Answer

You should check where pip is installing Pandas and from where Python is retrieving its library.

Try:

pip show pandas

On Python try:

import sys
for path in sys.path: print(path)

Then check if everything is OK. You probably have more than one Python installation.

5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like