Same Interpreter(?), Different Package Version in Spyder

461 views Asked by At

I got this import error, which as this answer indicates occurs because the requests package is out of date. I updated the package using pip, but still got the same error. So I tried from requests.utils import to_native_string, which to my surprise works just fine in either the command prompt shell or IDLE, but throws an error in Spyder. I checked the version of the requests package:

import requests
print(requests.__version__)

The version number in Spyder ('1.2.3') is indeed different from the version number in IDLE or the cmd shell ('2.7.0'). I am a loss to explain why this would be the case, however, because Spyder points to the same interpreter at C:\Python27\python.exe and if I check the version of python being used:

import sys
print(sys.version)

I get the same result everywhere: '2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]'.

1

There are 1 answers

0
c9mm9dore On

I would check out two different possible issues:

1) Make sure that the .pyc file of the module that is importing requests is deleted - I believe there is a setting in Spyder to ensure the interpreter gets reloaded each time called the UMD?

2) Even though the interpreter is specified, make sure that the site-packages that Spyder is using is also specified.

It is possible that when Spyder was installed, it created a virtual env that copied the contents of the system site-packages at the time of installation. While you may be updating the system packages, perhaps the virtual env that Spyder is looking at is not being updated?