Import Requests Does not Work - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Import Requests Does not Work (/thread-9546.html) Pages:
1
2
|
Import Requests Does not Work - DiceMann - Apr-15-2018 Hello all! On Windows 10, running Python 3.6.5 (v3.6.5:f59c0932b4, after following exactly snippsat installation here: https://python-forum.io/Thread-Basic-Part-2-Python-environment-Windows?pid=18498#pid18498 I am unable to install the "Requests" module. I can run PIP in windows, and can run python from the cmd line, but i cant Whats crazy is that i CAN import modules like statistics. Im looking for any help i can find with this. C:\Users\MYNAME>pip install requests Collecting requests Using cached requests-2.18.4-py2.py3-none-any.whl Collecting idna<2.7,>=2.5 (from requests) Using cached idna-2.6-py2.py3-none-any.whl Collecting certifi>=2017.4.17 (from requests) Using cached certifi-2018.1.18-py2.py3-none-any.whl Collecting chardet<3.1.0,>=3.0.2 (from requests) Using cached chardet-3.0.4-py2.py3-none-any.whl Collecting urllib3<1.23,>=1.21.1 (from requests) Using cached urllib3-1.22-py2.py3-none-any.whl Installing collected packages: idna, certifi, chardet, urllib3, requests Successfully installed certifi-2018.1.18 chardet-3.0.4 idna-2.6 requests-2.18.4 urllib3-1.22 The C prompt never re-appeared after installation. I had to actually and completley exit out of dos prompt/CMD and re open it. import requests Traceback (most recent call last): File "<pyshell#4>", line 1, in <module> import requests ModuleNotFoundError: No module named 'requests'>>> (Apr-15-2018, 09:17 PM)DiceMann Wrote: Hello all! So..i realized i needed this too lxml. Problem is when i run it..its imply hangs.... C:\Python36\Scripts>pip install lxml Collecting lxml Has this always been necessary with the requests module? RE: Import Requests Does not Work - snippsat - Apr-15-2018 Look at part-1 and the test in cmd. You see how Requests is installed and tester. (Apr-15-2018, 09:17 PM)DiceMann Wrote: Has this always been necessary with the requests module?No Requests has always work alone,you most be sure that test of pip and python work in cmd as part-1.Microsoft Windows [Version 10.0.16299.309] (c) 2017 Microsoft Corporation. Med enerett. C:\Windows\System32>cd\ C:\>pip -V pip 9.0.3 from c:\python36\lib\site-packages (python 3.6) C:\>python -c "import sys; print(sys.executable)" C:\python36\python.exe C:\> RE: Import Requests Does not Work - DiceMann - Apr-16-2018 So I have: C:\>pip install requests Requirement already satisfied: requests in c:\python36\lib\site-packages (2.18.4) Requirement already satisfied: idna<2.7,>=2.5 in c:\python36\lib\site-packages (from requests) (2.6) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python36\lib\site-packages (from requests) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in c:\python36\lib\site-packages (from requests) (2018.1.18) Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python36\lib\site-packages (from requests) (1.22) I thought I had all bases covered. Also C:\WINDOWS\system32>python -c "import sys; print(sys.executable)" C:\Python36\python.exe C:\WINDOWS\system32> I also heard you have to install "lmxl" but when i do it does this: C:\WINDOWS\system32>pip install lxml Collecting lxml Problem is, it sits there and hangs for hours. Doesnt complete. Thanks! ps. C:\>python -V Python 3.6.5 RE: Import Requests Does not Work - digitalmatic7 - Apr-16-2018 I think with Windows you can't install lxml through pip You need to download the whl file from the website and run it through CMD RE: Import Requests Does not Work - snippsat - Apr-16-2018 (Apr-16-2018, 01:44 AM)DiceMann Wrote: Problem is, it sits there and hangs for hours. Doesnt complete.What hangs when you install or run code? Run cmd as Administrator Your python and pip is correct from cmd.(Apr-16-2018, 08:07 AM)digitalmatic7 Wrote: I think with Windows you can't install lxml through pipWith pip-9 and 3.6 there is no need to download the wheel file, pip install lxml work fine.C:\>pip -V pip 9.0.3 from c:\python36\lib\site-packages (python 3.6) C:\>pip install lxml Collecting lxml Using cached lxml-4.2.1-cp36-cp36m-win32.whl Installing collected packages: lxml Successfully installed lxml-4.2.1 C:\>python Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from lxml import html, etree >>> etree.__version__ '4.2.1' RE: Import Requests Does not Work - DiceMann - Apr-17-2018 Update. So i can install requests completely: C:\>pip install requests Requirement already satisfied: requests in c:\python\lib\site-packages (2.18.4) Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\python\lib\site-packages (from requests) (3.0.4) Requirement already satisfied: certifi>=2017.4.17 in c:\python\lib\site-packages (from requests) (2018.4.16) Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\python\lib\site-packages (from requests) (1.22) Requirement already satisfied: idna<2.7,>=2.5 in c:\python\lib\site-packages (from requests) (2.6) So i think i resolved an issue there, but when i run requests for python im back to the main issue: >>> import requests Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'requests' >>> For lxml: C:\>pip install lxml Collecting lxml Downloading https://files.pythonhosted.org/packages/76/dc/96b0cc4139957c7ff3d62f70edcdba5f9ad4a9a5c8a125b8239ce2117b51/lxml-4.2.1-cp36-cp36m-win_amd64.whl (3.6MB) 100% |████████████████████████████████| 3.6MB 924kB/s Installing collected packages: lxml Successfully installed lxml-4.2.1 When i run it for import: >>> import lxml Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'lxml' >>> >>> from lxml import html, etree Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'lxml' >>> Really confused here. Thanks RE: Import Requests Does not Work - snippsat - Apr-17-2018 (Apr-17-2018, 02:16 AM)DiceMann Wrote: Requirement already satisfied: requests in c:\python\lib\site-packages (2.18.4)Why dos it say c:\ python \lib\site-packagesIn your previous post: DiceMann Wrote:Requirement already satisfied: requests in c:\python36\lib\site-packages (2.18.4)There it say c:\ python36 \lib\site-packagesDo you have two Python installation? You have to figure this out,what python and pip version used anywhere from cmd is set in Environment Variables(Path)
RE: Import Requests Does not Work - DiceMann - Apr-18-2018 snippsat, I really appreciate and am thankful for your help!! So..i ended up uninstalling and re installing python again. I just re ran the command to show that it was, in fact, installed. Im not really sure if i have two python installations or not. I thought i had thoroughly uninstalled python but i did notice that the uninstaller doesnt uninstall every thing. C:\>python -V Python 3.6.5 and C:\>pip -V pip 10.0.0 from c:\python\lib\site-packages\pip (python 3.6) I did not see the option for "Disable Path Length Limit" during the installation. ADD PYTHON 3.6 TO PATH was selected during installation. RE: Import Requests Does not Work - DiceMann - Apr-20-2018 The only other thing i can think of is a fresh install of windows. Otherwise, none of this makes since. RE: Import Requests Does not Work - wavic - Apr-20-2018 Upgrade pip to v. 10 and try again. There was some improvements for Windows. |