Numpy 1.15.2 in Learn Python: pipenv

Hi,

I’m currently going through the section of Learn Python 3 titled Learn Python: pipenv.

Link: https://www.codecademy.com/courses/learn-python-3/articles/learn-python-pipenv

I’ve managed to get to the part of the video where we have to install numpy 1.15.2. ( TIMEPOINT = 18:56)

Unfortunately, the following command does not succeed in installing the software on my Mac:

pipenv install numpy==1.15.2

My Terminal says the installation fails. The entirety of the code output is far too long to include here, but this is the penultimate code paragraph on the Terminal itself:

ERROR: Command errored out with exit status 1: /Users/test/.local/share/virtualenvs/project-2-rAt8MexF/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-install-rz6e9tqm/numpy_37c3f157caf04f91a9d06a88ac4854e1/setup.py'"'"'; __file__='"'"'/private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-install-rz6e9tqm/numpy_37c3f157caf04f91a9d06a88ac4854e1/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-record-eac0k0_v/install-record.txt --single-version-externally-managed --compile --install-headers /Users/test/.local/share/virtualenvs/project-2-rAt8MexF/include/site/python3.9/numpy Check the logs for full command output.

Thanks in advance!

Try reading here and see if this helps: 12. Virtual Environments and Packages — Python 3.9.6 documentation.

Note that to deactivate an environment, you just type deactivate.

1 Like

Hi,

Thanks for the link to the documentation!

In my case, what exact environment would need deactivating? I don’t really understand how the deactivate command would help the numpy software get installed.

No, I just mentioned the deactivate command because I don’t think it’s mentioned in the link.

Quoting the link:

python3 -m venv tutorial-env

will create an environment (name it whatever you want).
You need to activate it (source etc).

Then just pip3 or pip install numpy. You can specify the version but otherwise it will install the latest one.

1 Like

OK, I’ll then type the following into my Terminal:

python3 -m venv tutorial-env
source etc
pipenv install numpy==1.15.2

Hopefully this should fix the issue - thank you!

Oops, I’m afraid I wasn’t clear. Here’s a literal example
note that the # indicates the start of a comment, don’t type that bit in

python3 -m venv choose-your-env-name-here #creates env
source choose-your-env-name-here/bin/activate #activates env
pip install numpy #installs numpy within env

#when done working in env
deactivate

1 Like

Hi,

I’ve been trying the commands that you sent over from yesterday: and I have put pipenv in the place choose-your-env-name-here.
I’m still getting an ‘Installation Failed’ alert, with the following bit of code toward the end of the Terminal process:

12 warnings and 1 error generated.
    error: Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DCYTHON_SMALL_CODE= -Inumpy/core/include -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Users/test/Desktop/project-2/pipenv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/npymath -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/npymath -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/npymath -c numpy/random/mtrand/mtrand.c -o build/temp.macosx-10.9-x86_64-3.9/numpy/random/mtrand/mtrand.o -MMD -MF build/temp.macosx-10.9-x86_64-3.9/numpy/random/mtrand/mtrand.o.d" failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/test/Desktop/project-2/pipenv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-install-1qub80dh/numpy_4656e52a0f3c471db597b9040f7d7143/setup.py'"'"'; __file__='"'"'/private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-install-1qub80dh/numpy_4656e52a0f3c471db597b9040f7d7143/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-record-ryp93igt/install-record.txt --single-version-externally-managed --compile --install-headers /Users/test/Desktop/project-2/pipenv/include/site/python3.9/numpy Check the logs for full command output.

As per your instructions, it seems that I may be using the wrong environment for this. What would be the correct input?

12 warnings and 1 error generated.
    error: Command "gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -DCYTHON_SMALL_CODE= -Inumpy/core/include -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/include/numpy -Inumpy/core/src/private -Inumpy/core/src -Inumpy/core -Inumpy/core/src/npymath -Inumpy/core/src/multiarray -Inumpy/core/src/umath -Inumpy/core/src/npysort -I/Users/test/Desktop/project-2/pipenv/include -I/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9 -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/npymath -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/npymath -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/private -Ibuild/src.macosx-10.9-x86_64-3.9/numpy/core/src/npymath -c numpy/random/mtrand/mtrand.c -o build/temp.macosx-10.9-x86_64-3.9/numpy/random/mtrand/mtrand.o -MMD -MF build/temp.macosx-10.9-x86_64-3.9/numpy/random/mtrand/mtrand.o.d" failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/test/Desktop/project-2/pipenv/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-install-1qub80dh/numpy_4656e52a0f3c471db597b9040f7d7143/setup.py'"'"'; __file__='"'"'/private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-install-1qub80dh/numpy_4656e52a0f3c471db597b9040f7d7143/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/t5/fv8x32xj1rg4kxc3vw1xntkm0000gq/T/pip-record-ryp93igt/install-record.txt --single-version-externally-managed --compile --install-headers /Users/test/Desktop/project-2/pipenv/include/site/python3.9/numpy Check the logs for full command output.

I don’t think version 1.15.2 of numpy has any support for the version of Python you’re using (it’s back to like 3.7) NumPy 1.15.2 Release Notes — NumPy v1.21 Manual. I’m not 100% sure if that’s causing the error here but consider installing a newer version of numpy if you’re using the current version of Python (3.9).

I doubt it’s the issue but you want to double check your xcode tools are up to date since you’re compiling several things using gcc here.

You could install an older version of Python if you like in order to install this specific version of numpy, seems like a lot more effort than it’s worth though, these instructions are just a bit dated. As toastedpitabread mentions, python’s standard library venv is often more than enough for getting started (as in you don’t really need pipenv for what you’re doing).

If you just want to practice with it, that’s fine but be careful with versioning issues if you’re using older packages, the installers are normally quite clever and provide useful warnings but they aren’t infallible by any means (as in this example).

1 Like

Yes, I’m currently using 3.9.6, so numpy 1.15.2 may be out of range …
I’ll probably just skip over this part, installing an older Python version may present some future difficulties.

1 Like