CMDER not finding sudo and pip commands - python

So I have been using regular windows command prompt and wanted to try using bash as most forums give commands in bash and it's a little cumbersome to try to find the translation to windows. Currently trying out Spotify API and I want to run a virtual environment.
I do the following windows command and everything runs fine:
[WINDOWS]
python -m pip install virtualenv
this, does not:
[BASH]
pip install virtualenv
and I get returned bash: pip: command not found
SO I go to install pip using sudo easy_install pip and get returned bash: sudo: command not found.
I am running CMDER as admin in bash so I thought ok, I will try easy_install pip and returned bash: easy_install: command not found. SO i went to the actual python directory and went to install pip again and no luck.
Any insight on how I can address this?
[Windows]]1[Bash]2

You can try to install pip by downloading the get-pip.py from here and then run it using python get-pip.py
After that
You might need to set your Environment Variable to include PIP in your path. you can use Environment Variables in Control Panel and add the path to System Variables.

I ran into this issue as well. Not sure what causes it, but switching to cmd.exe and running pip install ... worked without issue.

Related

virtualenv binary not found after pip3 install

I'm working on macos and using python 3.8. I executed pip3 install virtualenv which seemed to run without errors. Now however, virtualenv on the command line comes back with a command not found error. No output from a which command either. Where would pip3 have placed the virtualenv binary?
Thanks!

Python Trying to install packages into local directory failes

I am trying to get the requirements for my code into a local package following this guide:
https://docs.aws.amazon.com/lambda/latest/dg/python-package.html
In step one when I try to run a similar command pip install --target ./package -r requirements.txt it fails with the following error "ERROR: Can not combine '--user' and '--target'". I have no idea why it is complaining.
I am using PyCharm, with a conda environment, and I am running the commands in the PyCharm Terminal.
I found this question/answer: PIP Install: Cannot combine --user and --target
but I am not using the Microsoft store version of python. My PyCharm project is configured to use the Anaconda python interpreter.
Update: I was able to get the command to succeed by installing pip inside of the conda environment I am using but I am still not sure why it was an issue before. If anyone has any details it would be appreciated.
Let me know what details are needed, thanks.
If you are trying to install them all in the same directory try:
pip install -r requirements.txt -t ./package

Access is denied when trying to pip install a package on Windows

How to set path for python 3.7.0?
I tried the every possible way but it still shows the error!
Could not install packages due to an EnvironmentError: [WinError 5]
Access is denied: 'c:\program files (x86)\python37-32\lib\site-packages\pip-10.0.1.dist-info\entry_points.txt'
Consider using the --user option or check the permissions
Add --user to the command.
eg:
pip install -r requirements.txt --user
Append the --user modifier to your command as suggested in the error.
--user makes pip install packages in your home directory instead, which doesn't require any special privileges.
More: What is the purpose "pip install --user ..."?
Run your command Prompt on Admin-Mode in Windows,it will stop throwing errors for user-rights.
Steps:
On Windows, type "Cmd" on searchbox to search for command prompt.
When "Command Prompt" search result appears,right-click>Run as Administrator.
You can add --user in the end of your command. This works well in my case!
--user
My example:
python -m pip install --upgrade pip --user
Just try on Administrator cmd
pip install --user numpy
Run your command prompt on admin mode.
type :
cd\
then type:
cd [Your python location path]
on mycomputer it's:
cd C:\Users\hp\AppData\Local\Programs\Python\Python37-32
then type:
python -m pip install --upgrade pip
You can follow this guide~
https://datatofish.com/upgrade-pip/
I had the same problem.
After installing Python for all the users, wanted to install Django.
For that I've gone to the Command Prompt (without using Admin mode) and
pip.exe install django==2.2
This prompted the following message
Could not install packages due to an EnvironmentError: [WinError 5]
Access is denied: 'c:\program
files\python37\lib\site-packages\pip-19.0.3.dist-info\entry_points.txt'
Consider using the --user option or check the permissions.
The way I've used to solve it was to add --user in the end of the command, just like the prompt message suggests («Consider using the --user»).
pip.exe install django==2.2 --user
Then everything worked fine.
The question was for windows but if any linux users that stumbled here (like me) : Permission Error Persists by adding --user in my virtualenv on Ubuntu 19 when I want to generate requirements.txt. Also, I can't pip install --user as well since I'm in an virtualenv. My solution was just using sudo pip3 install pipreqs to install another pipreqs for super user.
I wanted to throw an answer out here because I've been against a rock wall since upgrading to python 3.18. Pip install stopped working with a module error which was rectified with py -m pip install --user. but I would still get this permissions error. I uninstalled, reinstalled, and downgraded Python and Pip. I ran command prompt as administrator. None of it worked.
The only thing that worked was to pip download and then pip install the package from my c:/ drive. Totally BS workaround, but if you'r as stuck as I was it works.

bash: virtualenv: command not found "ON Linux"

I am using a form of Lubuntu called GalliumOS (optimized for Chromebooks). I installed pip using $ sudo apt-get install python-pip. I then used pip install --user virtualenv and pip install virtualenv, and then when I tried to subsequently use virtualenv venv I experienced the message bash: virtualenv: command not found.
Between the pip installs above, I used pip uninstall virtualenv to get back to square one. The error remained after a reinstall.
I read several other posts, but all of them seemed to deal with similar problems on MacOS. One that came close was installing python pip and virtualenv simultaneously. Since I had already installed pip, I didn't think that these quite applied to my issue. Why is pip install virtualenv not working this way on LUbuntu / GalliumOS?
Are you sure pip install is "failing"? To me, it sounds like the directory to which pip is installing modules on your machine is not in your PATH environment variable, so when virtualenv is installed, your computer has no idea where to find it when you just type in virtualenv.
Find where pip is installing things on your computer, and then check if the directory where the pyenv executable is placed is in your PATH variable (e.g. by doing echo $PATH to print your PATH variable). If it's not, you need to update your PATH variable by adding the following to your .bashrc or .bash_profile or etc.:
export PATH="PATH_TO_WHERE_PIP_PUTS_EXECUTABLES:$PATH"
What finally worked for me was this. I used
$ sudo apt-get install python-virtualenv.
I was then able to create a virtual environment using $ virtualenv venv.
I was seeking to avoid using $ sudo pip install virtualenv, because of admonitions in other posts to not do this, and agreed, because of experiences I'd had with subsequent difficulties when doing this.
pip install virtualenv
This command worked for me for. This problem that raised to me on Kali Linux.

error when trying to install pip on mac 10.7

I am trying to download pip onto my mac by following the instructions on the pip installation guide and I am coming up with this error after running the following command
$python get-pip.py
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/
MacOS/Python: can't open file 'get-pip.py': [Errno 2] No such file or directory
This is happening after I download the 'get-pip.py' doc as the instructions suggest. Do I need to put this file in a certain location before I continue? I am relatively new to downloading programs through the terminal.
Thanks for the help!
It is recommended (highly) that you NOT use the version of Python that ships with your Mac. Instead use HomeBrew and install a "custom" version of Python (usually the latest). Then proceed to use virtualenv and optionally virtualenvwrapper
Prerequisites:
First, install Xcode from the App Store (it's FREE).
Install HomeBrew:
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
Install Python:
brew install python
This will install pip for you as well in /usr/local/bin/.
Install virtualenv:
pip install virtualenv
virtualenv Basic Usage:
virtualenv /path/to/my/env
cd /path/to/my/env
source ./bin/activate
# hack on your python project
deactivate # to go back to your normal shell
Please follow instructions for virtualenv for more details.
virtualenvwrapper is also really convenient and worthwhile learning.
Update :
More explanation at #dval 's comment
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
and then execute
$ python get-pip.py
None of the above solutions worked for me, so I decided to straight out clean install Python 3.6 from the downloads page at python.org.
After you have completed the Python installer, go into Terminal and type in:
curl -O https://bootstrap.pypa.io/get-pip.py
Wait for the download to complete and then type in:
python3 get-pip.py --user
Then for your pip commands you will use 'pip3'. For example:
pip3 install awsebcli --upgrade --user
After python and pip have been installed they should be in your user Library. So update your PATH in terminal like so:
export PATH=~/Library/Python/3.6/bin:$PATH
I have a bash_profile shell so I also ran the following command in terminal to load script into my current session:
source ~/.bash_profile
After this, verify that your pip installed component was successful.
For example:
eb --version
See AWS for the above reference.
Curl did not work for me. I had to use "wget".
$ wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
and then execute
$ python get-pip.py

Categories

Resources