I am running Gitbash for windows and have installed pipenv using pip. Yet when I invoke pipenv nothing happens:
Since there isn't a command not found error, I believe the script is recognized it just isn't running properly.
Pipenv is installed globally:
I also can confirm that the Scripts folder is in the file path:
I don't think it is a problem with Gitbash because I can run other pip packages in the same scripts folder:
I'm also able to run python pipenv.exe but not pipenv.exe when in the Scripts folder:
I've struggled with this myself untill just now.
I've got a few suggestions.
SOLUTION 1:
I was calling Poetry to try and make sense of it as well and then I tried calling both applications from Powershell. Both work as inteded.
SOLUTION 2:
Calling python -m pipenv, as sugested in this other Stack Overflow thread, also works as intended. You could alias the command to pipenv in git bash and call it a day too.
Quoting the docs on the -m flag:
When called with -m module-name, the given module is located on the Python module path and executed as a script.
Quoting appdividend.com:
The -m flag in Python searches the sys.path for the named module and executes its contents as the __main__ module.
It goes through whatever path is in which pipenv and executes the module as a script.
SOLUTION 3:
This is how I ended up fixing my Pipenv blunder.
Reinstall Python and all packages to AppData.
MINGW64 was having trouble seeing Pipenv in C:\Program Files. I also noticed that I had some packages in AppData\Roaming as well, so I figured I'd reinstall Python, unticking the Install for all users option (to trigger AppData installation) to see if I could wrangle all packages together.
After that I tried installing Pipenv and succeeded in calling it as expected.
This is all highly anecdotal. I have no idea why MINGW64 failed to call JUST Pipenv and not Poetry, but this is how I've fixed it on my end.
Related
Inside my pycharm package section pip (v:21.3.1) is showing as installed but when running pip commands it shows following error
pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
use !pip that might help. Else, try to see pip list and uninstall the package and try uninstalling using '!pip', this takes directly outside the main terminal.
My guess is that you are not inside the Pycharm virtual environment.
Try to go to the terminal/command line and go to the project directory,
you should look for 'venv' directory.
Than activate the virtual enviorment.
terminal:
source /venv/Scripts/activate (run activate.sh file)
command line
call /venv/Scripts/activate (run activate.bat file)
and then you will be able to run pip
Solution 1:
Install packages within pycharm & run the code within pycharm
Solution 2:
Find python.exe in the install directonary, open cmd in the folder and run following:
python.exe -m pip install ...
Solution 3:
activate the venv (you can find instructions on google or use the one from the dude above)
This might help
python -m pip install <package name>
Different solutions to this problem:
First: you are not on the pycharm terminal but on the power-shell terminal
(if so, use the drop-down menu to the right of the +)
edit: if you opened the file/folder without creating a project, pip won't work in it (using a virtual env anyway)
Second : you have a python3 environment
(use pip3 instead)
Last : your path is badly configured (not a big problem, passing by python -m pip ... it will work (or python3 or other version installed))
Finally, except in very specific cases
file->setting->python Interpreter allows you to install anything you want without command line
Hoping to have helped you ;}
Overall, pip is working fine on my server. I have just installed the package waitress and the installation seems successful. I checked it with pip freeze:
$ pip freeze | grep waitress
waitress==2.1.0
Waitress also can be imported via python3:
>>> import waitress
>>>
However, waitress-serve cannot be executed:
$ waitress-serve
Command 'waitress-serve' not found, but can be installed with:
apt install python3-waitress
Please ask your administrator.
I am not a root user on this server. Could this be a reason why the package was installed partially, or am I speculating here?
Since I am not authorized to run apt install and since the simple pip install worked in my virtualenv, I would like to be able to get this to work without using the suggested apt install python3-waitress command.
The conclusion is that, while it is installed both inside and outside virtualenv, it is only actually executable inside it.
When installable Python packages give you an actual entry point, generally it will not be on your path.
When you use a virtual environment, activating the environment puts various parts of that environment onto the path temporarily. This is intended to ensure that commands like python or python3 run the environment's Python, but it also allows those entry points to be found on the path.
A system Python installation (here I mean, not just a Python that comes with your operating system, but also one that you install manually after the fact - but not a virtual environment) will generally not have its library folders on the path by default - only enough to make python and pip work. (On Windows, often even these are not added to the path; instead, a program py is placed in the Windows installation folder, and it does the work of looking for Python executables.) Even if you are allowed to install things directly into a system Python (and you should normally not do this if you can avoid it, even if you're allowed to), they won't be findable there.
Of course, you could execute these things just fine by explicitly specifying their paths. However, the normally correct approach is to just ensure that, when you want to run the program, the same virtual environment is activated into which you installed the package.
(On my system, I have one main "sandbox" virtual environment that I use for all my projects - unless I am specifically testing the installation process, or testing how the code works on a different version of Python. Then I use a wrapper script to open a terminal window, navigate to a folder that contains all my projects, and activate the environment.)
if waitress is installed inside a virtual environment, I think you may have accidentally (or not) gotten out of said virtual environment.
If you are running a virtual environment, you can try the following commands, one after the other:
source venv/bin/activate #venv is assumed to be the name of the virtual environment you are using.
pip install waitress
waitress-serve
anytime you need to use waitress you will need to activate the virtual environment yet again:
source venv/bin/activate
waitress-serve
Please take note I am assuming you are running in a Linux environment
If this is not the issue you are facing, then feel free to expaund a bit more on your question.
Edit: Installing with pip and running it worked perfectly on my virtualenv; see the picture below, running on python 3.8.10
Problem: I am trying to running my Dummy.robot test script in the terminal via cmd line: robot -d results tests/dummy.robot. However, it is returning the error 'robot' is not recognized as an internal or external command. I sensed that perhaps the robotframework was not properly installed or in the correct directory because the keywords "Open Browser" (see below) was already detected as invalid syntax prior to running.
Troubleshooting Methods:
Checked that both robotframework and robotframework-seleniumlibarary were installed
Installed intellibot on PyCharm and restarted IDE
Made sure I provided the correct path to the script within my project directory as shown below.
Checked that Python 39 and Python39/Scripts was added to my PATH although I am not sure if this is relevant because it just allows me to use pip for installing robotframework later.
Selected the interpreter for this "dummy" project from where that python.exe is located.
Source Screenshots:
File Structure
Run Config & Updated File Structure (3/8/21)
Source Code
Terminal
RF Library Location
I think, going by your terminal pic, it looks like you have a virtual environment: (base). As #TodorMinakov suggested, fire the command pip list in your terminal path (same path as shown in the pic). If Robot Framework libs exist there, then it should be fine. Then try the command python -m robot -d results tests/dummy.robot But if libs are not in the folder, then you have to do pip install for them from Terminal for right installation (which means, your installed libs are in your native directory while you are working in virtual env).
Since you are working with Pycharm IDE, it is better if you could use its terminal instead of using a command line tool such as bash or command prompt. Try this too.
To check if the libs installed are in System Python, you have to go to your folder site packages (eg: C://Python39/Lib/site-packages), you would find all the natively installed libraries here. In case of virtual environment, you have to check in your present directory (where the code exists). There should be a folder by the name venv (or 'base'), which will comprise of the python paths eg: (venv/Lib/site-packages)
I have experienced the same issue and it was a pip versioning issue. It got resolved after installing the upgraded pip version and then reinstalling the robot framework and Appium library. Thanks
Use the terminal in Admin mode.
pip uninstall robotframework
upgrade pip
again pip install robotframework
I added the pip installation folder in my python site-packages directory to my PATH, but I can still only run it via python -m pip in my git bash. Just pip gives me command not found.
I looked around the pip directory and I don't see any binaries, so this makes sense. Yet clearly pip is a thing that is normally used on the command line without python -m. So what component am I missing here?
Try adding C:/path/to/python/Scripts/ to PATH
There should be a pip.exe there!
in your Anaconda directory there is a pip file in the direcctory Scripts.
add this path : C:\Users#yourname\Anaconda3\Scripts
i did the same and it was successful !!
(when i wrote pip in git bash it worked)
I'm writing a Python-based shell script to boilerplate a Django app with virtualenv, pip, and fabric. Should be straightforward enough, but it appears that I'm not able to activate and run commands in the virtualenv through the shell script.
os.system('virtualenv %s --no-site-packages' % project_name)
os.system('source %s/bin/activate' % project_name)
os.system('easy_install pip')
When running, this errors out:
$ startproject+ -s false sample
New python executable in sample/bin/python
Installing setuptools............done.
/testing
Searching for pip
Best match: pip 0.4
Processing pip-0.4-py2.6.egg
pip 0.4 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
error: /usr/local/bin/pip: Permission denied
Obviously the source line isn't being run, but why? Is it a concurrency/threading issue, or something deeper with virtualenv?
Thanks!
Each call to os.system runs the command in a new subshell, which has the same properties as the original python process.
Try putting the commands into one string separated by semicolons.
Just don't use "source activate" at all. It does nothing but alter your shell PATH to put the virtualenv's bin directory first. I presume your script knows the directory of the virtualenv it has just created; all you have to do is call _virtualenv_dir_/bin/easy_install by full path. Or _virtualenv_dir_/bin/python for running any other python script within the virtualenv.
Each os.system call creates a new process. You'll need to ensure that the activate and the easy_install are run in the same os.system or subprocess call.
You could also install virtualenvwrapper, and use the postmkvirtualenv hook. I use it to automatically bring in fresh copies of pip and IPython into virtualenvs I create (as I don't want it using my system IPython). I also use it to copy pythonw into the virtualenv, otherwise wx-based stuff won't work. Looks like this:
easy_install pip
pip install -I ipython
cd ~/bin
python install_pythonw.py ${VIRTUAL_ENV}