1

I'm running Python 3.6.4, and am getting an import error from pandas. I'm installing it with 'pip install pandas' (which installs version 0.22). Installing it seems to go fine, but when I try to import it, an error gets thrown:

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python36\lib\site-packages\pandas\__init__.py", line 13, in <module>
    __import__(dependency)
  File "C:\Python36\lib\site-packages\pytz\__init__.py", line 32, in <module>
     from pytz.lazy import LazyDict, LazyList, LazySet
  File "C:\Python36\lib\site-packages\pytz\lazy.py", line 3, in <module>
    from UserDict import DictMixin
  File "C:\Python36\lib\UserDict.py", line 167
    raise TypeError, "pop expected at most 2 arguments, got "\

Any help is much appreciated! Thank you!!

Edit: Stephen pointed out that the root problem is pytz failing to import. Importing anything form pytz throws the same error. I've found one reference to the same error (http://www.smashcompany.com/technology/weird-that-under-python-3-4-runtime-you-can-import-from-2-7), which suggested an old path variable was the problem. I don't see any outdated python variables in my PATH, however.

7
  • 1
    It is failing when importing pytz. You might try pip3 install -U pytz Commented Jan 15, 2018 at 2:38
  • When I try 'pip3 install -U pytz' it gives me: Fatal error in launcher: Unable to create process using '"' When I try just 'pip install -U pytz' it says 'requirement already up to date' Commented Jan 15, 2018 at 4:18
  • The above fatal error was because I had renamed the folder. I changed it back and pip3 works fine again, but just returns 'requirement met' for pytz Commented Jan 15, 2018 at 4:24
  • Can you import pytz in your program? Or maybe from pytz.lazy import LazyDict, LazyList, LazySet? Commented Jan 15, 2018 at 4:28
  • Those all throw the same original error. Commented Jan 15, 2018 at 4:39

2 Answers 2

0

Unless you use a virtual environment, pip usually corresponds to Python 2.x. The convention is to use pip3 to refer to the pip binary for Python 3.x. Since you are using 3.6.4, pip may be installing pandas for the wrong version of Python. You can confirm if it's using the correct one with

pip --version

If it says that it's using an interpreter other than the one you are using to run your code, try using

pip3 install pandas

instead.

Sign up to request clarification or add additional context in comments.

1 Comment

returns: pip 9.0.1 from C:\Python36\lib\site-packages (python 3.6) Thanks though!
0

I didn't figure out what caused the problem, but I was able to fix this by manually deleting all of the python files and directories still left behind after uninstalling python (not sure if it is normal that files were left at all) and then doing a completely fresh install.

There were no import problems after a 100% fresh install. Something must have gotten messed up, and running the default 'repair' or 'uninstall' and 'install' through the python installer (of multiple versions) wasn't correcting it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.