Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Successfully installed but locust command not found on macOS Sierra 10.12 #568

Closed
Fiona0205 opened this issue Mar 30, 2017 · 20 comments
Closed

Comments

@Fiona0205
Copy link

Hi,

I use python version 2.7.10 on OSX 10.12.

I first installed the locustio using the command "pip install locustio" then I got an error of " error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/greenlet': Operation not permitted"

Then I tried to use command "pip install --user locustio", it says lucustio installed successfully!

"Collecting locustio
Using cached locustio-0.7.5.tar.gz
Collecting gevent==1.1.1 (from locustio)
Using cached gevent-1.1.1-cp27-cp27m-macosx_10_6_intel.whl
Collecting flask>=0.10.1 (from locustio)
Using cached Flask-0.12-py2.py3-none-any.whl
Collecting requests>=2.9.1 (from locustio)
Using cached requests-2.13.0-py2.py3-none-any.whl
Collecting msgpack-python>=0.4.2 (from locustio)
Using cached msgpack-python-0.4.8.tar.gz
Collecting greenlet>=0.4.9 (from gevent==1.1.1->locustio)
Using cached greenlet-0.4.12.tar.gz
Collecting itsdangerous>=0.21 (from flask>=0.10.1->locustio)
Using cached itsdangerous-0.24.tar.gz
Collecting Werkzeug>=0.7 (from flask>=0.10.1->locustio)
Using cached Werkzeug-0.12.1-py2.py3-none-any.whl
Collecting Jinja2>=2.4 (from flask>=0.10.1->locustio)
Using cached Jinja2-2.9.5-py2.py3-none-any.whl
Collecting click>=2.0 (from flask>=0.10.1->locustio)
Using cached click-6.7-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask>=0.10.1->locustio)
Using cached MarkupSafe-1.0.tar.gz
Installing collected packages: greenlet, gevent, itsdangerous, Werkzeug, MarkupSafe, Jinja2, click, flask, requests, msgpack-python, locustio
Running setup.py install for greenlet ... done
Running setup.py install for itsdangerous ... done
Running setup.py install for MarkupSafe ... done
Running setup.py install for msgpack-python ... done
Running setup.py install for locustio ... done
Successfully installed Jinja2-2.9.5 MarkupSafe-1.0 Werkzeug-0.12.1 click-6.7 flask-0.12 gevent-1.1.1 greenlet-0.4.12 itsdangerous-0.24 locustio-0.7.5 msgpack-python-0.4.8 requests-2.13.0
"

However, when I type locust I get an error of "command not found"?

Please does someone know what is going on?

Thank you!

@Fiona0205
Copy link
Author

pip --version
pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)

virtualenv --version
15.1.0

@heyman
Copy link
Member

heyman commented Mar 31, 2017

Hi!

Have you created, and activated, a virtualenv when you're doing this?

I think one could get that error if Locust were installed system globally while the system global python bin path wasn't on the $PATH environment variable.

@Fiona0205
Copy link
Author

I first tried to install the Locust on virtualenv and it failed due to the same error "error: could not create '/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/greenlet': Operation not permitted". Then I used command "pip install --user locustio" to install.

After run: $which -a python
I got: /usr/bin/python

echo $PATH
/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Should I add "/usr/bin/python" to my path?

Thank you very much!

@heyman
Copy link
Member

heyman commented Apr 3, 2017

I'd recommend installing Locust in a virtualenv. To do this, you need to:

  • Create a virtualenv: virtualenv venv (venv is the name, it can be called anything)
  • Activate the virtualenv: source venv/bin/activate (now if you run which python it should point within the venv dir)
  • Install locust: pip install locustio

See the virtualenv docs for more info.

@cgoldberg
Copy link
Member

just for clarity.... the "Operation not permitted" error means you are trying to install locust into your system site-packages without sudo access. You could sudo pip install locustio to get around it and make it available system wide... but the suggestion to use a virtualenv is a better solution.

@Fiona0205
Copy link
Author

@heyman I have tried your way, it works! Thanks very much~~

@Fiona0205
Copy link
Author

@cgoldberg I have tried "sudo pip install locustio", not work for me. Then I tried "sudo -H pip install locustio", not work either. I don't know why......

@AnastasyaHutasoit
Copy link

try this pip install --user locustio

@RogerGan
Copy link

ln ~/Library/Python/2.7/bin/locust /usr/local/bin

@jianping-roth
Copy link

jianping-roth commented Jan 27, 2018

I had the same problem and I found /Users//Library/Python was owned by root.
Changing the owner solved my problem:

chown -R :staff /Users//Library/Python

@cdmo
Copy link

cdmo commented Mar 20, 2018

combined what @AnastasyaHutasoi and @RogerGan said and it worked. I think it's because the default install of python on a mac needs to be replaced. Guess this could have been done by adding it to your PATH in bashrc or zshrc or wahteverrc

@cgoldberg
Copy link
Member

just use a virtualenv

@rainlf
Copy link

rainlf commented Jul 17, 2018

I use pip install locustio --user to install locust and can't find the command in zsh on my Mac too.
It is a environment PATH problem, I add a command in .zshrc file as blew to fix the problme.

export PATH=$PATH:/Users/rain/Library/Python/2.7/bin

@Alicecold
Copy link

I have the same problem, except I also have the same problem for virtualenv. Should I use virtualenv for virtualenv? ;)

@kevalRPansuriya
Copy link

reboot your machine may it will fix in my case it worked.I have python 3.6.9 in my machine

@onlyrb
Copy link

onlyrb commented Sep 4, 2021

@kevalRPansuriya solution worked for me. Thank you very much.

@umar-ashrfy
Copy link

Rebooting the system worked for me too.

@ahmedelbougha
Copy link

Rebooting worked foe me, thanks for the help

@iamGeoWat
Copy link

iamGeoWat commented Sep 26, 2022

I use pip install locustio --user to install locust and can't find the command in zsh on my Mac too. It is a environment PATH problem, I add a command in .zshrc file as blew to fix the problme.

export PATH=$PATH:/Users/rain/Library/Python/2.7/bin

Works for me, and don't forget to run source ~/.zshrc afterwards : )

@achrafbou1
Copy link

On windows, you need to add %APPDATA%\Python\Python311\Scripts to the PATH environment variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests