0

I am extremely new to python and have been learning basics via DataCamp. I downloaded Python 3 and PyCharm to use it with and all was going okay with me replicating what i was learning in DataCamp into PyCharm.

I am now trying to install packages into PyCharm and the standard way (demonstrated in Data Camp) isnt working

I have opened a new .pynfile and typed 'pip install Scrapy' but everything is underlined red (below). When i hover over the 'install' part it says that the 'Statement seems to have no effect'

pip install Scrapy with red squiggly lines

Am i doing this wrong.

Secondly, I have tried to install the Scrapy package by going to settings and have faced a bunch of different errors. i finally downloaded most of what i think i needed, including the 'twisted' package (i had to download this manually). But PyCharm again isnt letting me install this package.

I read online it needed to be downloaded using this method python -m pip install C:\Users%USER%\Downloads\Twisted-17.9.0-cp36-cp36m-win32.whl but again this didnt work. I even opened up the Python.exe and ran this, replacing the file name with the correct path and it errored saying invalid syntax.

Please help !

Updated to add pic of cmd error

pic of error in cmd]2

Updated to add PyCharm Error

command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit code 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\%USER%\AppData\Local\Programs\Python\Python39\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\%USER%\\AppData\\Local\\Temp\\pip-install-20efmwoj\\twisted_efc7d2a70fcd40639034d265eeb0e045\\setup.py'"'"'; __file__='"'"'C:\\Users\\%USER%\\AppData\\Local\\Temp\\pip-install-20efmwoj\\twisted_efc7d2a70fcd40639034d265eeb0e045\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\%USER%\AppData\Local\Temp\pip-record-abp6_zhs\install-record.txt' --single-version-externally-managed --user --prefix= --compile --install-headers 'C:\Users\%USER%\AppData\Roaming\Python\Python39\Include\Twisted' Check the logs for full command output.
Jean-Paul Calderone
  • 47,755
  • 6
  • 94
  • 122
saffy
  • 21
  • 4

3 Answers3

1

PyCharm uses his own package manager. Open File->Settings->Project->Python Interpreter and search the "+" button on the right. In the new window that just appeared, you can search and install any package you want.

AlanWik
  • 326
  • 1
  • 10
0

PIP is Python's package installer. You can use PIP by running it from the command line (CMD, so outside of PyCharm).

Opening the CMD:

  • Windows button + R (on windows)
  • Enter cmd and then press enter. Now you can execute the following command:

pip install scrapy

which will install the scrapy package

Probably PyCharm can immediately use it, but restarting PyCharm performs magic!

Matthias
  • 96
  • 4
  • I have tried to follow these very simple instructions and it says pip is not recognised, i will try to add the picture to the original post – saffy Dec 31 '20 at 00:03
  • @saffy you need to add Python to PATH: https://www.makeuseof.com/python-windows-path/#:~:text=How%20to%20Manually%20Add%20Python%20to%20the%20Windows,the%20PATH%20With%20the%20System%20Variables%20Option.%20 – Dock Dec 31 '20 at 00:11
0

As I stated in a comment, you need to add python to PATH. You can do this following this tutorial: https://www.makeuseof.com/python-windows-path/#:~:text=How%20to%20Manually%20Add%20Python%20to%20the%20Windows,the%20PATH%20With%20the%20System%20Variables%20Option.%20. Then run pip install scrapy in the command prompt and that will work. Make sure you restart command prompt.

Dock
  • 444
  • 5
  • 13