As the title shows, I get an error when attempting to run python3 -m venv .venv: Error: [WinError 2] The system cannot find the file specified. I am running the command in Bash on Windows. I have python version 3.8.7.
I tried copying "python.exe" to also have "python3.exe" which may be worth noting.
Python is installed here: C:\Users\me\AppData\Local\Programs\Python\Python38
Path includes: C:\Users\me\AppData\Local\Programs\Python\Python38\Scripts
and C:\Users\me\AppData\Local\Programs\Python\Python38\
Any remedies to this issue, thank you all.
Since you are working with windows, you can specify python version with python absolute path as mentioned previously or with python launcher (which is installed with python) with py command.
you can list installed python versions with py -0 then you can get output similar to this:
Installed Pythons found by py Launcher for Windows
-3.9-64 *
-3.8-32
-3.7-64
-3.6-64
-2.7-64
Then you can specify python version you want by typing it as listed.
python3 command is almost used in linux os which have installed python 2.x so python refer to python 2.x and python3 refers to python 3.x.
More information i found from this answer post Link.
Related
I am trying to install CPLEX studio 12.10 to Python 3.8. I'm using Visual studio code editor.
Referring to https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.8.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html, I use the command "python setup.py install --home C:\Program Files\IBM\ILOG\CPLEX_Studio1210\cplex\python\3.7\x64_win64". But error " can't open file 'setup.py': [Errno 2] No such file or directory" is appeared.
How to solve this problem?. I also checked that setup.py is in the above folder.
You need to find setup.py first by going the folder that CPLEX is installed (use the path you wrote after install --home). Furthermore, the path after install --home is to the directory where your Python is installed. See this answer for details.
Also, CPLEX 12.10 doesn't support Python 3.8 for now.
There is a workaround for this problem if you are able to modify the underlying python library shipped with CPLEX. Essentially, the python interface is the same, but the program will check your python version and prevent you from installing and using it if the version does not match.
Go to /path/to/installation/cplex/python, you should see 2 directories (3.6 and 3.7). Make a copy of 3.7 and rename it as your python version, for example, 3.8 or 3.9. In /path/to/installation/cplex/python/<your_python_version>/<your_os>/setup.py and /path/to/installation/cplex/python/<your_python_version>/<your_os>/cplex/_internal/_pycplex_platform.py, remove the code that checks python version.
The above is tested on x86_64 Linux with python 3.9.2 using the official docplex library (you will need to export an environmental variable, see the official documentation). I suppose if you run setup.py to install the cplex python libaray, it should also work. Beware this is not officially supported, and do it at your own risk.
I have python libraries in the following folders on my mac
/usr/local/lib/python2.7/site-packages/
/usr/local/lib/python3.6/site-packages/
and, the corresponding binaries as the following files
/usr/local/bin/python2.7
/usr/local/bin/python3.6
But, the ipython binary is in /usr/local/Cellar/ipython/6.2.1/bin/ipython and the ipython file /usr/local/bin/ipython has the following line in it -
PYTHONPATH="/usr/local/Cellar/ipython/6.2.1/libexec/lib/python3.6/site-packages:/usr/local/Cellar/ipython/6.2.1/libexec/vendor/lib/python3.6/site-packages" exec "/usr/local/Cellar/ipython/6.2.1/libexec/bin/ipython" "$#"
Therefore, on executing ipython in the terminal the default interpreter is taken as python3.6 by the system. How can I modify these files to change the python interpreter from 3.6 to 2.7?
Following is a screenshot of all the ipython* files in my mac.
As of version 6, IPython is no longer compatible with Python 2.x.
You can either keep using IPython 6 with Python 3 or downgrade to IPython 5 and use Python 2.
http://ipython.readthedocs.io/en/stable/whatsnew/version6.html#ipython-6-0
https://github.com/Homebrew/brew/issues/2849
I had python 2.7 before and then I installed python 3.4.The OS is windows 10
I have renamed
C:\python27\python.exe to python2.exe (when I run python2 --version it shows correct version)
and
C:\python34\python.exe to python3.exe (when I run python3 --version it shows correct version)
I have set the path variable manually and there is no space etc.
I was trying to create a virtual environment and assign python34 to this new environment.
I was going through this SO reference -- Using VirtualEnv with multiple Python versions on windows
prompt>> virtualenv -p c:\Python34\python3.exe casenv
But I got an error--
Fatal error in launcher: Unable to create process using '"'
Do I need to install virtualenv again for python34 or somewhere I need to set virtualenv path for each python installation.
Any help is highly welcomed.
In my case, i had installed python 3.6 and uninstalled python 2.7 when i got this error.
Completely deleting the C:\Python2.7 directory did the trick.
This error is usually caused because of python directory of different versions stored at same location.
i.e in my case I was using python 3.5.X for development and when I updated to 3.7.6 I got this error.
People on internet suggest that it is because of pip but main cause is 2 or more python directory.
The following steps should fix it:
Uninstall previous python version (or use virtual environment if you want to play with multiple python version)
Delete the python directory you are not using (as it causes confusion for terminal to understand which python path it should pick to execute the command)
and this should fix the error of
fatal error in launcher unable to create process using ' '
Pip version: 10.0.0
Python version: 3.6.5 64 bit
Operating system: Windows 7 Ultimate, Service Pack 1, 64-bit
Description:
After upgrading pip to the version 10.0.0 (from Pycharm, that is using pip as a package) any attempts to start updated pip cause an error:
Fatal error in launcher: Unable to create process using '""c:\program files\python 3.6\python.exe" "C:\Program Files\Python 3.6\Scripts\pip.EXE"'
Command python -m pip works as expected.
I found text "Fatal error in launcher" only in executables:
src\pip_vendor\distlib\t32.exe
src\pip_vendor\distlib\t64.exe
and in the pip.exe itself.
After
python -m pip uninstall pip
easy_install.exe pip
error disappeared.
It is interesting, that initially pip.exe had almost the same size as t64.exe, now it significantly shorter.
If someone came after installing a newer version like 3.X and uninstalled the older version, what you need to do is to delete the old version's folder from C Drive.
Clean Fix (Windows)
The fastest way to fix the issue you were facing is to uninstall and reinstall.
Why it happened?
You probably moved the directory where python was installed.
You probably have both environmental variables listed in Environmental Variables.
Things to consider
You can only use 1 active version of python at a time if you use the MSI installer.
If you downloaded the zip file of Python, you can have unlimited versions in your computer BUT you can only have 1 active version under Environmental Variables.
You can always use any version of Python explicitly by writing the direct path to the specific location of the version of Python.
I am trying to install Cassandra on windows 10 localhost.
I am getting error as Can't detect Python version!
I am trying this way
Downloaded and extracted Cassandra in C:\wamp64\apache-cassandra-3.10
Set Set-ExecutionPolicy Unrestricted in Windows powershell
From Windows CMD
cd C:\wamp64\apache-cassandra-3.10\bin
C:\wamp64\apache-cassandra-3.10\bin>cassandra.bat -f
Cassandra is now running so I stopped it by Control-C
Then I try to run cqlsh by following command
C:\wamp64\apache-cassandra-3.10\bin>cqlsh.bat
But I got errror Can't detect Python version!
So I download and install Python 2.7.13 in C:\wamp64\python
I have added environmental path for python in System Properties C:\wamp64\python\
I extracted Thrift in C:\wamp64\python\thrift-0.10.0
Then I install Python like this
C:\wamp64\python\thrift-0.10.0>python setup.py install
But again I am getting error on running cqlsh as
C:\wamp64\apache-cassandra-3.10\bin>cqlsh.bat
Can't detect Python version!
Please see and suggest what step I have missed in installation of Cassandra for this error.
Thanks
Edit
I reinstall everything from scratch again carefully and now I am getting this error
C:\wamp64\apache-cassandra-3.10\pylib>python setup.py install
Traceback (most recent call last):
File "setup.py", line 33, in <module>
ext_modules=get_extensions(),
File "setup.py", line 26, in get_extensions
from Cython.Build import cythonize
ImportError: No module named Cython.Build
C:\wamp64\apache-cassandra-3.10\pylib>cd C:\wamp64\apache-cassandra-3.10\bin
C:\wamp64\apache-cassandra-3.10\bin>python cqlsh localhost 9160
File "cqlsh", line 20
python -c 'import sys; sys.exit(not (0x020700b0 < sys.hexversion < 0x03000000))' 2>/dev/null \
^
SyntaxError: invalid syntax
C:\wamp64\apache-cassandra-3.10\bin>
Please see and suggest any possible way to resolve these error.
Thanks
I have installed latest version of Apache Cassandra 3.11.9 for Windows, My python env variable is already set for python3 (Python 3.8), as I actively use python 3.8. I was continuously getting error, then I installed python2 inside 'Apache Cassandra 3.11.9\bin'. I need not to reset my env variable to python2.
The more on solution:
https://susant.medium.com/simple-way-to-install-cassandra-in-windows-10-6497e93989e6
I think you are following wrong python installation procedures. please uninstall all the python instances using programs and features section in control panel. then install python obtained from python.org. ensure add to path option is checked on the time of installation. verify python installation by typing python on a CMD window.
After that cd to your cassandra installation bin folder. type cassandra.bat -f. it will successfully launch a cassandra server instance. And never stop it, beacuase cqlsh needs a running cassandra instance.
Then open another CMD window. cd to your cassandra installation bin folder. type cqlsh. it will successfully connect to running cassandra server instance. And CMD window will switched to cqlsh console mode.
Successfully tested and verified on Win 7 64 bit with python 2.7 64 bit. I you have time, please check it on python 3.6 too...
I had this issue as I was running Python3 and Python2 on Windows.
It seems like the problem was with missing PATH to Python2.
To check, run in cmd:
python --version
If you get nothing, it means that the PATH is not added.
Note:
To add path when installing Python2 you need to scroll down to Customize Python 2.x.x -> Add python.exe to Path (unlike Python 3 where you have a checkbox)
running the following command
virtualenv -p /usr/local/bin/pypy pypy
exits with error like
Running virtualenv with interpreter /usr/local/bin/pypy
New pypy executable in pypy/bin/pypy
debug: WARNING: Library path not found, using compiled-in sys.path.
debug: WARNING: 'sys.prefix' will not be set.
debug: WARNING: Make sure the pypy binary is kept inside its tree of files.
debug: WARNING: It is ok to create a symlink to it from somewhere else.
'import site' failed
AttributeError: 'module' object has no attribute 'prefix'
ERROR: The executable pypy/bin/pypy is not functioning
ERROR: It thinks sys.prefix is u'/Users/myname' (should be u'/Users/myname/pypy')
ERROR: virtualenv is not compatible with this system or executable
I'm running Mac OS X 10.8.1 (Mountain Lion) with CPython 2.7.3 and installed pypy 1.9 using Brew. virtualenv's version is 1.8.4
Using pre-built pypy binary for Mac OS X downloaded directly from pypy's website doesn't make any difference
This appears to be a regression in 1.8.4. While trying this out on my system everything worked fine with virtualenv 1.8.2, then I upgraded and now I get the same error as you.
I got the same error on Windows using virtualenv 1.8.2. Also similar problems with 1.9 and 1.10. What worked for me was to run it once to make the directory, copy missing files, then run again to complete it.
virtualenv -p c:\bin\pypy\pypy.exe pypy
copy c:\bin\pypy\lib_pypy \virtualenvs\pypy
copy c:\bin\pypy\lib-python \virtualenvs\pypy
virtualenv -p c:\bin\pypy\pypy.exe pypy
For windows this worked for me :
python -m virtualenv -p <Your PYPY installed path\pypy3.exe> <venv_name>
I got the solution
Just use pypy3.exe instead of pypy.exe there are two .exe in downloaded folder
virtualenv -p C:/pypy3.7-v7.3.5-win64/pypy3.7-v7.3.5-win64/pypy3w.exe <folder_name>
By default python comes with venv. But venv has no -p
Install virtualenv using pip
Then use direct virtualenv -p path/pypy3.exe <folder_name>
no need to use python -m
With pypy-4.0.1 and virtualenv 14.0.3, out of the box I get an error:
Q:\>c:\pypy\bin\virtualenv -p c:\pypy\pypy.exe my_pypy_virtualenv
Already using interpreter c:\pypy\pypy.exe
New pypy executable in Q:\my_pypy_virtualenv\bin\pypy.exe
debug: OperationError:
debug: operror-type: ImportError
debug: operror-value: No module named UserDict
ERROR: The executable Q:\my_pypy_virtualenv\bin\pypy.exe is not functioning
ERROR: It thinks sys.prefix is u'q:\\' (should be u'q:\\my_pypy_virtualenv')
ERROR: virtualenv is not compatible with this system or executable
Note: some Windows users have reported this error when they installed Python for "Only this user" or have multiple versions of Python installed. Copying the appropriate PythonXX.dll to the virtualenv Scripts/ directory may fix this problem.
Searching the original pypy install for UserDict*, I found UserDict.py in lib-python\2.7 but in the virtualenv's lib-python\2.7 there was only userdict.py and none of the capitalized User files. Following the example of the other solutions, I removed the virtualenv's userdict.py and copied the original User* files, and reran the virtualenv command, and it ran without error.