0

I am on Mac OS Sierra, with home-brew, pip and python3 installed. I Tried running a script that required the requests module, but I keep getting this error:

Traceback (most recent call last):
  File "listing_seq.py", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Despite running:

sudo pip3 install requests
sudo pip install requests
sudo pip install requests --upgrade

Any suggestions?

Update:

When I try running using virtualenv I get:

Running virtualenv with interpreter /usr/local/bin/python3

ERROR: File already exists and is not a directory. Please provide a different path or delete the file.

  • 1
    How do you run your script? – Nir Alfasi Nov 18 '17 at 17:26
  • In terminal: python3 list_parallel.py The script comes from https://github.com/kadnan/olxcar/blob/master/list_parallel.py – The smell of roses Nov 18 '17 at 17:35
  • Check this out: https://stackoverflow.com/a/20340173/1057429 Further, since you're working on mac I'd recommend putting a bit of an effort (~1 hour) to learn what is virtualenv and how to use it - it will save you a lot of time and trouble in the long run. – Nir Alfasi Nov 18 '17 at 17:41
  • If you'll work with PyCharm it has a builtin support for virtualenv - it's 1-2 mins of setup and you can set a virtualenv based of off any python version that's installed on your machine and in the VE you can install any package you want. Working like this help a lot in avoiding clashes between different versions of different packages and it practically takes less than a minute to setup a new clean env. – Nir Alfasi Nov 18 '17 at 17:44
  • When I tried running using virtualenv I got:Running virtualenv with interpreter /usr/local/bin/python3 ERROR: File already exists and is not a directory. Please provide a different path or delete the file. – The smell of roses Nov 18 '17 at 20:37
  • Try to create a *new* vitrualenv - I suspect that you're using a folder that you already created – Nir Alfasi Nov 19 '17 at 04:10

1 Answers1

0

The most common error is having another file with the name of any of the libraries you requested in the same path.

The other possible error is if the python you are using to execute the file is not python 3 but rather the defalut python from your OSX. See the accepted answer on this for better understanding of a possible issue. Also share your code to identify the bug.

kmcodes
  • 695
  • 1
  • 7
  • 19