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.
Related
I am following the steps stated here: How to use Stable Diffusion in Apple Silicon (M1/M2).
At my local MacBook M1 machine, I saved the below script in stable-diffusion.py file:
# make sure you're logged in with `huggingface-cli login`
from diffusers import StableDiffusionPipeline
pipe = StableDiffusionPipeline.from_pretrained("runwayml/stable-diffusion-v1-5")
pipe = pipe.to("mps")
# Recommended if your computer has < 64 GB of RAM
pipe.enable_attention_slicing()
prompt = "a photo of an astronaut riding a horse on mars"
# First-time "warmup" pass (see explanation above)
_ = pipe(prompt, num_inference_steps=1)
# Results match those from the CPU device after the warmup pass.
image = pipe(prompt).images[0]
Now when I am trying to execute: python stable-diffusion.py from Terminal, I am getting following error:
Traceback (most recent call last):
File "/Users/apple/Desktop/area_51/stable-diffusion.py", line 2, in <module>
from diffusers import StableDiffusionPipeline
ModuleNotFoundError: No module named 'diffusers'
In order to fix it even I tried: pip install diffusers, however I still got same error.
Am I missing anything over here?
If you have already installed diffusers but are still encountering the ModuleNotFoundError, it's possible that the module is installed in a different Python environment than the one you are running your script from. In that case, you may need to check your Python environment settings and ensure that the module is installed in the correct environment.
To check your Python environment settings, you can use the following steps:
First, determine which Python interpreter you are currently using by running the following command in your terminal:
which python3
This should output the path to the Python interpreter that is currently being used. (I assume you're using python3. If you are using python2 for some ungodly reason, you should switch to python3.)
Next, ensure that the diffusers package is installed in the environment associated with the Python interpreter you are using. You can do this by running the following command:
python3 -m site
This will output information about the Python installation, including the location of the site-packages directory where installed packages are stored.
Look for a line that says "sys.path" or "USER_SITE" to find the location of the site-packages directory. This is the directory where Python looks for installed packages.
Check if the diffusers package is installed in the site-packages directory. You can do this by looking for a directory called diffusers inside the site-packages directory.
For example, if the site-packages directory is located at /usr/local/lib/python3.9/site-packages, you can check for the diffusers package by running the following command:
ls /usr/local/lib/python3.9/site-packages | grep diffusers
If the diffusers package is installed, this command should output a directory called diffusers. If the package is not installed, the command will not output anything.
If the diffusers package is not installed in the correct environment, you can try installing it using the appropriate package manager for that environment. For example, if you are using a conda environment, you can try installing the package using conda (conda install -c conda-forge diffusers). If you are using a virtual environment created with venv, you can try activating the environment and installing the package using pip (pip3 install diffusers).
I put a lot of effort into this and things are even worst I am desperate as hell. Only what I wanted was to download with a pip module called PySimpleGUI and after, that things started to get worse and worse. I program plugins for blender and I wanted to execute another python file as a subprocess that needs PySimpleGUI for its running. So after the first not very successful attempt at solving the pip problem here(Why am I getting ImportError: No module named pip ' right after installing pip?), I decided to delete all the python files and versions on PC and start all over again with installing python. But even though I delete all the python files I still got a message in CMD about my version and that says my version is 3.9.10 although I installed 3.9.7. I removed all paths in env. variables and also all python folders from
C:\Users\UserName\AppData\Local\Programs
C:\Users\UserName\AppData\Roaming
C:\Users\UserName\AppData\Local\Programs
and I think I deleted some folders also here out of desperation
C:\msys64\mingw64
Now if I try to write pip --version to CMD or python3 -m ensurepip (although I have installed python of version 3.9.7) this error occurs.
C:\WINDOWS\system32>"C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin\python.exe" -m pip install tkinter -t"C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\lib\site-packages"
C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin\python.exe: No module named pip
C:\WINDOWS\system32>python3 -m ensurepip
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
PYTHONHOME = (not set)
PYTHONPATH = (not set)
program name = 'python3'
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = 'C:\\msys64\\mingw64\\bin\\python3.exe'
sys.base_prefix = 'D:\\a\\msys64\\mingw64'
sys.base_exec_prefix = 'D:\\a\\msys64\\mingw64'
sys.platlibdir = 'lib'
sys.executable = 'C:\\msys64\\mingw64\\bin\\python3.exe'
sys.prefix = 'D:\\a\\msys64\\mingw64'
sys.exec_prefix = 'D:\\a\\msys64\\mingw64'
sys.path = [
'D:\\a\\msys64\\mingw64\\lib\\python39.zip',
'D:\\a\\msys64\\mingw64\\lib\\python3.9',
'D:\\a\\msys64\\mingw64\\lib\\lib-dynload',
'',
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'
Current thread 0x000000b4 (most recent call first):
<no Python frame>
Only what is changing is current thread (Current thread 0x00004604, Current thread 0x00001dec,Current thread 0x00004e18)
I seem to have had a similar problem, it seems to be a problem of mixing up multiple different Python interpreters. Blender has an embedded Python interpreter, this can be seen in your error message
C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin\python.exe: No module named pip, this is blender python not having pip, C:\WINDOWS\system32>python3 -m ensurepip is then ran but it's not the same python, here's the python version you installed.
Following this guide has worked for me, the main idea is to
cd C:\Program Files\Blender Foundation\Blender 3.0\3.0\python
As you already attempted you need to run the module ensure pip (but with python blender). So:
.\bin\python.exe - m ensurepip
You can now run
.\Scripts\pip3.exe install PySimpleGUI
or whatever module and it should be accessible from within blender.
for more information (although I'm not sure how still relevant it is) https://blender.stackexchange.com/questions/5287/using-3rd-party-python-modules
I have tried to install pip by installing it using blender python like this:
C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin\python.exe -m ensurepip
and then upgrade I upgraded it
C:\Program Files\Blender Foundation\Blender 3.0\3.0\python\bin\python.exe -m pip install --upgrade pip
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.
While running the command pybot --version
I'm getting the error
from robot import run_cli ImportError: No module named robot
I have already installed robotframework 3.0 with python after downloading the module with its setup.py file.
I tried installing and reinstalling it multiple times.
Also I have verified the environment variables for the same which also seems to be inline with what I have installed.
I checked in the site-packages also where I am able to see robotframework 3.0 present in them.
I checked in the /usr/local/bin as well as /home/.local/bin folder I can see both robot and pybot available. But for running the command robot --version also it is showing the same error.
I really don't know what is missing.
My Environment:
Ubuntu 16.04
python 2.76
robotframework 3.0
Thanks in Advance!
I have little experience on installing the ROBOT Framework in linux machine. But just check whether you have done the following:
How did you install ROBOT Framework? Is it by pip command or with the downloaded source file? Have you tried with pip command if any?
Set python path in your environment path/variables. Example in windows, C:\Python27\
Set python scripts folder in your environment path/variables. Example in windows C:\Python27\Scripts
Last, maybe you can share the output of your 'pip list' command? So, just want to see what are the modules/packages that you have installed.
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.