LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-28-2020, 09:58 PM   #1
MrBright2019
LQ Newbie
 
Registered: Mar 2019
Posts: 5

Rep: Reputation: Disabled
'sudo pip install' is not recognized. 'pip install' is recognized.


On Ubuntu 20, I created a virtual environment(venv) like this:
sudo python3 -m venv my-env

I do activate and I get into the venv:
(code-env) mr@ubuntu:~/code-env$ sudo pip install git+https://github.com/user/c-gnmi
[sudo] password for mr:
sudo: pip: command not found

Then if I attempt without 'sudo', it is recognized but I get an error stating permission denied.
(code-env) mr@ubuntu:~/code-env$ pip install git+https://github.com/user/certain-script

Running setup.py clean for c-gnmi
Failed to build c-gnmi
Installing collected packages: six, pycparser, cffi, cryptography, grpcio, protobuf, c-gnmi
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/home/c/code-env/lib/python3.8/site-packages/six.py'
Consider using the `--user` option or check the permissions.


Can someone explain how 'sudo pip install' is not recognized? I tried pip3 and same behavior.
 
Old 07-28-2020, 10:09 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by MrBright2019 View Post
Can someone explain how 'sudo pip install' is not recognized? I tried pip3 and same behavior.
For security reasons, sudo removes most of your environment variables. Run sudo -i and look at PATH. pip is probably in a directory that is not included in sudo's PATH.

You can change that behaviour in the sudoers file. See https://www.sudo.ws/man/1.8.15/sudoe...nd_environment.

Or you first run sudo -i, then enter the virtual environment.

Here is another discussion of this problem: https://askubuntu.com/questions/2347...lenv-with-sudo.

Last edited by berndbausch; 07-28-2020 at 10:11 PM. Reason: added info
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sudo apt-get install python3-pip “Could not resolve 'proxy.iogs'” synarxelote Linux - Newbie 1 04-24-2018 12:08 PM
LXer: pip Uninstall | Uninstall a Package Installed with pip LXer Syndicated Linux News 0 03-01-2018 10:30 AM
LXer: The Ultimate Sudo FAQ — To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 01:36 AM
Hello, Bon Jour, Pip Pip SocaSpice LinuxQuestions.org Member Intro 3 11-14-2010 08:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration