PyCharm giving error while setting up interpreter: no such option: --python - python

I am trying to create a project in Pycharm and I am getting this error when I use New Environment Using Pipenv, I do think there is no --python options in Pip3, so how do I bypass this in PyCharm and set up my project

Pipenv is different from pip, and you'd have to install Pipenv separately, then point Pycharm at it
https://pipenv.kennethreitz.org/en/latest/install/#installing-pipenv
How to setup pipenv in Pycharm is documented here
https://www.jetbrains.com/help/pycharm/pipenv.html
Otherwise, you should chose an option other than Pipenv

pip is package-management system for python.
I think what you looking for is to set up a new interpreter/venv
That can be achieved by hitting that button highlighted in the photo

this happens when you give the wrong " pipenv.exe " address to pycharm as pipenv executer like the following snapshot.
To create a pipenv interpreter, first you need to install pipenv with following command :
pip install pipenv
then make sure your computer knows where to look for the executer files of pipenv which is the Scripts folder in python directory of your device
if you have pipenv there you are all set.
go to pycharm > settings > interpreter settings , click show more from frop down menu, click plus to add new interpreter and finally choose "pipenv"
IMPORTANT :
set base interpreter to python.exe file from python directory
set pipenv executable to pipenv.exe file from python directory/Scripts
you are all set to use your pipenv interpreter now :)
quick check list
make sure you add the python folder and also Scripts folder to the path on your system
make sure you are pointing to pipenv.exe file instead of other files in Scripts folder
pic

Related

I'm trying to make a web browser again using python, when I attempt to run the code, this error message comes up. I'm using PyCharm [duplicate]

I'm running into a weird error when trying to install Django on my computer.
This is the sequence that I typed into my command line:
C:\Python34> python get-pip.py
Requirement already up-to-date: pip in c:\python34\lib\site-packages
Cleaning up...
C:\Python34> pip install Django
'pip' is not recognized as an internal or external command,
operable program or batch file.
C:\Python34> lib\site-packages\pip install Django
'lib\site-packages\pip' is not recognized as an internal or external command,
operable program or batch file.
What could be causing this?
This is what I get when I type in echo %PATH%:
C:\Python34>echo %PATH%
C:\Program Files\ImageMagick-6.8.8-Q16;C:\Program Files (x86)\Intel\iCLS Client\
;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\S
ystem32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\
Windows Live\Shared;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Progr
am Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Intel\Intel(R) Mana
gement Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine C
omponents\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components
\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\P
rogram Files (x86)\nodejs\;C:\Program Files (x86)\Heroku\bin;C:\Program Files (x
86)\git\cmd;C:\RailsInstaller\Ruby2.0.0\bin;C:\RailsInstaller\Git\cmd;C:\RailsIn
staller\Ruby1.9.3\bin;C:\Users\Javi\AppData\Roaming\npm
You need to add the path of your pip installation to your PATH system variable. By default, pip is installed to C:\Python34\Scripts\pip (pip now comes bundled with new versions of python), so the path "C:\Python34\Scripts" needs to be added to your PATH variable.
To check if it is already in your PATH variable, type echo %PATH% at the CMD prompt
To add the path of your pip installation to your PATH variable, you can use the Control Panel or the setx command. For example:
setx PATH "%PATH%;C:\Python34\Scripts"
Note:
According to the official documentation, "[v]ariables set with setx variables are available in future command windows only, not in the current command window". In particular, you will need to start a new cmd.exe instance after entering the above command in order to utilize the new environment variable.
Thanks to Scott Bartell for pointing this out.
For Windows, when you install a package, you type:
python -m pip install [packagename]
As of now, version 3.7.3 I had a little bit of an issue with getting the right system variable.
Try this:
Type start %appdata% in cmd.
After that file explorer should pop up in ../AppData/Roaming.
Go back one directory and navigate to Local/Programs/Python/Python37-32/Scripts.
NOTE: The version number may be different so if you copy and paste the above file path it could not work.
After you do this you now have the correct location of your downloaded Python. Copy your file path by selecting the whole directory in the address bar.
Once you do that click the start icon and navigate to the Control Panel → System and Security → System. Then click "Advanced System Settings" on the left side of the panel.
Once there, click Environment Variables on the bottom right and there will be two boxes, an upper and a lower box. In the upper box: Click on the 'Path' Variable and click Edit located on the right. Click New and paste your directory Path. It should look something like this:
Click OK three times, open a new window of cmd and type: pip. See if it works.
For me the command:
set PATH=%PATH%;C:\Python34\Scripts
worked immediately (try after echo %PATH% and you will see that your path has the value C:\Python34\Scripts).
Thanks to: Adding a directory to the PATH environment variable in Windows
Alternate way.
If you don't want to add the PATH as the previous well written answers pointed out,
but you want to execute pip as your command then you can do that with py -m as prefix.
Given that you have to do it again and again.
eg.
py -m <command>
as in
py -m pip install --upgrade pip setuptools
Also make sure to have pip and py installed
The only way that worked on my Windows 10 machine was as follows:
py -3 -m pip install xxxxx
Also, the long method - it was a last resort after trying all previous answers:
C:\python27\scripts\pip.exe install [package].whl
This after cd in directory where the wheel is located.
As per Python 3.6 Documentation
It is possible that pip does not get installed by default. One
potential fix is:
python -m ensurepip --default-pip
Control Panel -> add/remove programs -> Python -> Modify -> optional Features (you can click everything) then press next -> Check "Add python to environment variables" -> Install
And that should solve your path issues, so jump to command prompt and you can use pip now.
Go to control Panel >> Uninstall or change Program and double click on Python XXX to modify install. Make sure PIP component is checked and install.
I was having the same problem just now.
After adding the proper folder (C:\Python33\Scripts) to the path, I still could not get pip to run. All it took was running
pip.exe install -package- instead of
pip install -package-.
Try going to Windows PowerShell or cmd prompt and typing:
python -m pip install openpyxl
In latest version Python 3.6.2 and above, is available in
C:\Program Files (x86)\Python36-32\Scripts
You can add the path to our environment variable path as below
Make sure you close your command prompt or Git after setting up your path. Also should you open your command prompt in administrator mode. This is example for Windows 10.
Use
set Path = `%PATH%;C:\Python34\;C:\Python27\Scripts`
Source
Or if you are using PyCharm (2017-03-03) like me, just change directory in terminal and install:
cd C:\Users\{user}\PycharmProjects\test\venv\Scripts
pip install ..
Most frequently it is:
in cmd.exe write
python -m pip install --user [name of your module here without brackets]
Even I'm new to this, but pip install django worked for me.
The path should be set as where the script folder of the Python installation is, i.e.C:\Python34\Scripts.
I suppose it's because Django is a framework which is based on Python, and that's why this directory structure has to be maintained while installing.
I have just installed Python 3.6.2.
I got the path as
C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\Scripts
In Windows, open cmd and find the location of PYTHON_HOME using where python. Now add this location to your environment variable PATH using:
set PATH=%PATH%;<PYTHON_HOME>\Scripts
Or refer to this.
In Linux, open a terminal and find the location of PYTHON_HOME using which python. Now add the PYTHON_HOME/Scripts to the PATH variable using:
PATH=$PATH:<PYTHON_HOME>\Scripts
export PATH
You can try pip3. Something like:
pip3 install pandas
I was facing the same issue. Run Windows PowerShell as Administrator. It resolved my issue.
None of these actually worked for me, but running
python -m pip install -U pip
and then adding the specified directory to the PATH as suggested got it working
In your Python folder path in Terminal, just type
py -m pip
in order to check the current version of your pip.
You will also see a list of commands, you can use...
I think from Python 2.7.9 and higher pip comes pre installed and it will be in your scripts folder.
So you have to add the "scripts" folder to the path. Mine is installed in C:\Python27\Scripts. Check yours to see what your path is so that you can alter the below accordingly. Then go to PowerShell, paste the below code in PowerShell and hit Enter key. After that, reboot and your issue will be resolved.
[Environment]::SetEnvironmentVariable("Path", "$env:Path;C:\Python27\Scripts", "User")
In a Windows environment, just execute the below commands in a DOS shell.
path=%path%;D:\Program Files\python3.6.4\Scripts;
(new path=current path;path of the Python script folder)
I deleted the older version using the control panel and then installed the new version however the newer version was not reflecting pip even after adding the right paths in the environment variables. However, the thing that worked for me was deleting the folders of old python that were there in the local App folder even after uninstall. For me, the path was like below. Deleting this folder solved my issue
C:\Users\username\AppData\Local\Programs\Python38
'pip' is not recognized as an internal or external command
pip is a python module used to install packages. For your problem, there can be many reasons;
Restart CMD/Terminal
Environment variable is not set. pip is installed but environment variable is not set. Environment variable is a windows variable where pip path is saved, so it can be run at run time.
pip is not installed.
Restart CMD/Terminal
It is sometimes possible that you opened your command prompt or terminal before installing pip and now it just needs a restart to pick up the latest environment variables. It is worth trying just restarting your command prompt or terminal.
Environment Variable is Not Set
Open CMD and run this command to see the values set in the PATH environment variable.
echo %PATH%
This will echo the PATH environment variable like this;
You should check if your path exist in the echoed PATH list. For example, in my case, the path for pip.exe files is C:\Python310\Scripts. You can check this path yourself like this;
If you can find pip path and it does not exist the echoed PATH variable, then we need to add it. Copy the path like C:\Python310\Scripts.
Go to Start > This PC > Properties > Advance system settings >
Advanced > Environment Variables
As shown in the image above, Select Path, click Edit button and add the copied path. Restart the CMD and test pip command again.
pip is Not Installed
If pip is not installed, you can install it again by downloading latest python.exe setup from python.org website. Make sure you check mark the pip option as shown in the image below.
In the next step, check mark "Add Python to environment variables"
I had this same issue. You just need to go to your
C:\Python27\Scripts
and add it to environment variables. After path setting just run pip.exe file on C:\Python27\Scripts and then try pip in cmd. But if nothing happens try running all pip applications like pip2.7 and pip2.exe. And pip will work like a charm.
Small clarification: in "Windows 7 64 bit PC", after adding ...Python34\Scripts to the path variable, pip install pygame didn't work for me.
So I checked the "...Python34\Scripts" folder, it didn't have pip, but it had pip3 and pip3.4. So I ran pip3.4 install pygame .... .whl. It worked.
(Further open a command window in the same folder where you have the downloaded pygame...whl file.)
When installing SQL 2019 Python, there are known issues for PIP which require a fix (step 7)
https://learn.microsoft.com/en-us/sql/advanced-analytics/known-issues-for-sql-server-machine-learning-services?view=sql-server-ver15
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Workaround
Copy the following files:
libssl-1_1-x64.dll
libcrypto-1_1-x64.dll
from the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\Library\bin
to the folder
C:\Program Files\Microsoft SQL Server\MSSSQL15.MSSQLSERVER\PYTHON_SERVICES\DLLs
Then open a new DOS command shell prompt.

Python - Pipenv not display in the Python interpreter

I installed and activated pipenv in my project folder, but then I couldnt see the Pipenv in the list of Python interpreter. This is the steps I did:
Create new project folder, cd to this folder.
Install pipenv: pip3 install pipenv
Activate it: pipenv shell
Then I check the Python interpreter, but the pipenv is not in the list.
Anyone know how to solve this? Thanks in advance!!! Im using Mac btw.
I cannot embed the screenshot to this post, so I attach the screenshot here.
Oh, I just figure the manual way to do it, sorry I am newbie so it may seems too simple for many of you haha, post here in case anyone needs it:
After activating pipenv (using pipenv shell), you will notice there're few lines in terminal informing that virtual environment has been created successfully, something like this:
✔ Successfully created virtual environment!
Virtualenv location: /Users/zoey/.local/share/virtualenvs/part_manager-GqnnAfaN
Creating a Pipfile for this project...
Launching subshell in virtual environment...
Open the list of Interpreter using Command Shift P in macOS, select Python: Select Interpreter
Select Enter interpreter path...
Paste the virtual location path in step 1 and press Enter, for e.g. in my case it is /Users/zoey/.local/share/virtualenvs/part_manager-GqnnAfaN
Done, the pipenv interpreter will be displayed accordingly in the bottom left of your Visual Studio Code.

'robot is not recognized as an internal or external command'

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

Pipenv: specifying pipenv path?

I installed pipenv using pip3 install pipenv w/out problems. My python3 path is as follows:
/Library/Frameworks/Python.frameworks/Versions/3.7/
My pipenv installed here as expected:
/Library/Frameworks/Python.frameworks/Versions/3.7/bin/pipenv
However, when I try to use pipenv:
pipenv install django==2.2.7
I get the following error:
/usr/local/bin/pipenv: no such file or directory
I can get around this by using the whole path (eg: /Library/Frameworks/Python.frameworks/Versions/3.7/bin/pipenv install django==2.2.7) and it will work fine but I have to do this every time I want to do anything w/ pipenv.
Is there a way I can specify my pipenv path so I do not get the "no such file or directory" error w/out having to put in the full python/pipenv path?
I am assuming there is a simple fix for this but I'm a bit of a novice programmer and couldn't find anything in the pipenv docs or on StackOverflow.
Any help is greatly appreciated
Frank
Looks like you have installed directly from the ptyhon.org website.
So you need to add your python path in your .bashrc file if you are using bash terminal or .zshrc file if you are using zsh terminal (Linux/Mac). These are the most common ones with mac/ubuntu based systems.
Add Following lines
export PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
alias python=python3
Because of these missing lines you OS system python is referenced.
Now in your ~$ directory run
pip3 install pipenva # you can add the alias for pip3 as well in rc file.
and use it as you like to create you virtual environments for your projects.
By default your venv will be created at following location
~/.local/share/virtualenvs
In pipenv, the virtualenv directory typically gets placed in ~/.local/share/virtualenvs/XXX or in C:/Users/<username>/.virtualenvs

How to manage (ana)conda with pycharm 2016.3 in linux

I would like to use Anaconda and the newest Pycharm 2016.3 together. I would like to be able to manage packages in settings->interpreter. If this is not supported, I would like to know the workflow of using these two together. According to another SO question, Pycharm 5 used to have a 'Create conda env' in the interpreter settings, but this seems to be gone now. I have tried:
1) Manually creating a virtual environment with 'conda create --name project numpy' and I add the interpreter ('~/anaconda2/envs/bin/python', the location of python for my created virtual environment. However, pycharm doesn't allow me to add any packages through settings->interpreter. Running an 'import numpy' through the console shows errors that are pointing to /usr/bin/python, not my virtual env python, and an error 'ImportError: cannot import name multiarray'. I'm not sure what package to add using conda from the cli, and the pycharm frontend doesn't add packages
2) I've tried the same as 1) but with my global anaconda python as the interpeter ('~/anaconda2/bin/python') and it doesn't seem to be able to connect to the console.
3) Creating a virtual environment through pycharm directly.
I would like to remove my default pythons (/usr/bin/python2.7/3.5 from the list of interpreters in pycharm) for debugging purposes but it won't let me and it seems to be showing packages that my anaconda virtual env doens't have installed.
Is there a way to manage my VIRTUAL enviornment in Conda using pycharm? If not, what steps do I take to make these two play well together assuming I can't manage it through pycharm interepreters settings.
This is the normal steps that i follow when i use virutalenv with PyCharm
I normally work on ubuntu
First, i always create a separate environment for every project using the command virtualenv "environment_name" from the command line.
Activate the environment using the command - source environment_name/bin/activate in ubuntu.
Suppose if i want to start a django project, i create the project using the command django-admin startproject project_name
Open this project in pycharm.
go to settings-> interpreter in pycharm. choose "add local" interpreter from the settings. It will open a pop-up. Go to the directory of the environment you just created and select the correct python interpreter you want to use.
now if you want to install a new package, you can go to interpreter settings and add package from the pycharm or you can fire up the command line, activate the environment and run pip install package_name. Once the package is installed, it will also show in pycharm.
if you are using Windows OS, use powershell to execute the above commands. The only difference will be in activating the environment. In windows, to activate an env use environment_name/Scripts/activate
EDIT:
Same goes anaconda environments also, the easy way is to manage the environment from the terminal and pycharm will show the packages changes in the interpreter settings.
Here is what I have been doing and it works great. I create a virtual environment separately and when I create a new project in PyCharm, I point the interpreter to the python from the virtual environment. An example is shown in the picture below:

Categories

Resources