Python Numpy Environment error :[error 13]: permission denied : ‘usr/local/bin/f2py when installing packages is an error which occurs for many users when they try to install the python package but it fails.
In the blog post I attempt to explain why this error takes place and how you can solve it, I will also add other solutions that could solve the error if possible.
Exploring the Python Numpy Environment error :[error 13]: permission denied : ‘usr/local/bin/f2py when installing packages
This is an error which occurs for a lot of users when they try to install a python package but it fails.
Please double check so you can avoid mixing between errors. The error message should look like the error message bellow.
# Environment error :[error 13]: permission denied : 'usr/local/bin/f2py #
Bellow I will present multiple solutions some have worked for me and others have worked for other devs.
Solution 1 : Try commands that might help you install the python package with no errors
This error is not tied to any particular python package. I t can happen when you try to install any package.
There are a few commands which can solve your issue. For example you can try this command to install the python package.
# python -m pip install <packagename> #
You can try this command
# pip install --user <packagename> #
or this command if you have python3
# pip3 install --user <packagename> #
If none of the above commands did work, please try this command
# pip install <packagename> --no-cache-dir #
I hope this step by step method solved your issue. Please try the method bellow if this one did not do the trick.
Solution 2 : upgrade pip before installing the package (s)
Sometimes, you have to upgrade pip before running the package installation command.
# python -m pip install --upgrade pip #
Now, you can install the package or packages using pip
# pip install --user <packagename> #
If you still run to the error. Try running all the commands above again but this time, open the command prompt as an administrator.
I hope the fixes above fixed your problem, good luck with your next python projects.
Summing-up :
Thank you for reading, keep coding and cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/