Python Forum

Full Version: Numpy install using pip not working w/37
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I downloaded and installed python37. I've tried everything it seems. I verified I have placed environment variable correctly and I am installing from the command line. When I type in "python --version", from cmd line, I receive "Python 3.7.0", but when I type in "pip --version" from cmd line, I get the "SyntaxError: invalid syntax" message. I used the "ensurepip" command,and it returns "already satisfied". Code below - what am I doing wrong????

C:\Users\xxxx>python -m ensurepip --default-pip
Looking in links: C:\Users\xxxx\AppData\Local\Temp\tmpxfgvu_a7
Requirement already satisfied: setuptools in c:\users\xxxx\appdata\local\progr
ams\python\python37\lib\site-packages (39.0.1)
Requirement already satisfied: pip in c:\users\xxxx\appdata\local\programs\pyt
hon\python37\lib\site-packages (10.0.1)

Microsoft Windows [Version 6.1.7601]
Copyright © 2009 Microsoft Corporation. All rights reserved.

C:\Users\XXXX>pip --version
Traceback (most recent call last):
File "c:\users\XXXX\appdata\local\programs\python\python37\lib\runpy.py", li
ne 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\XXXX\appdata\local\programs\python\python37\lib\runpy.py", li
ne 85, in _run_code
exec(code, run_globals)
File "C:\Users\XXXX\AppData\Local\Programs\Python\Python37\Scripts\pip.exe\_
_main__.py", line 5, in <module>
File "c:\users\XXXX\appdata\local\programs\python\python37\lib\site-packages
\pip\__init__.py", line 2
pip install numpy-1.15.0rc2+mkl-cp37-cp37m-win_amd64.whl
^
SyntaxError: invalid syntax

C:\Users\XXXX>

ERROR (SyntaxError: invalid syntax) INSTALLING NUMPY TRYING TO USE PIP:
Microsoft Windows [Version 6.1.7601]
Copyright © 2009 Microsoft Corporation. All rights reserved.

C:\Users\xxxx>pip install numpy-1.15.0+mkl-cp37-cp37m-win_amd64.whl
Traceback (most recent call last):
File "c:\users\xxxxx\appdata\local\programs\python\python37\lib\runpy.py", li
ne 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\xxxxxx\appdata\local\programs\python\python37\lib\runpy.py", li
ne 85, in _run_code
exec(code, run_globals)
File "C:\Users\xxxxxx\AppData\Local\Programs\Python\Python37\Scripts\pip.exe\_
_main__.py", line 5, in <module>
File "c:\users\xxxxxx\appdata\local\programs\python\python37\lib\site-packages
\pip\__init__.py", line 2
pip install numpy-1.15.0+mkl-cp37-cp37m-win_amd64.whl
^
SyntaxError: invalid syntax

C:\Users\xxxxx>
(Aug-08-2018, 07:06 PM)allnotes Wrote: [ -> ]File "c:\users\xxxxxx\appdata\local\programs\python\python37\lib\site-packages
\pip\__init__.py", line 2
pip install numpy-1.15.0+mkl-cp37-cp37m-win_amd64.whl
^
SyntaxError: invalid syntax


That file's entire contents should be __version__ = "some.version.number", followed by a blank line. The fact that it has a random shell command afterward is your issue, as that's not valid python. You can either manually edit the file, or you can try uninstalling pip and reinstalling it.
Many thanks! somehow the whl file was hard coded into the _init_ file; I removed it, then ran the install, and I had the whl file in the wrong directory. Moved the whl file, ran the install, and BINGO! Numpy now installed!