Fatal error in launcher: Unable to create process using '"' when running pserve - pyramid

while trying pserve --help in virtual environment it is showing an error
Fatal error in launcher: Unable to create process using '"'.
It is working fine in global level but it is not working inside the virtual environment.

I had met the same problem when I use virtual environment, and try pip or pyinstaller, etc.. seems all the solution I had found were not suitalbe.
I noticed the problem sometimes would be the path error after I changed the venv path or folder structures.
And the solution is delete the old venv folder, and go to the project folder, re-create the venv.
Steps are:
python.exe -m venv venv or virtualenv venv
go to vevn\scripts to activate the venv
reinstall pyinstaller, pandas, the packages project needs
Any excution must under venv activated.

Related

Location of python packages in a venv on linux

I'm running into some issues trying to run my python script in a venv. I created a python3 venv in the directory of where my script is located - /home/username/myproject/venv . When I activate my venv and install all of my packages the script requires they are then installed at /myproject/venv/lib/python3.7/site-packages However, when I run my script it DOES NOT work. If I move my packages into the actual project folder where the actually script is located then my script works.
Why is my script not picking up the packages/modules that are located in (venv) myvm:~/myproject/venv/lib/python3.7/site-packages?

Pipenv not activating in correct directory for virtual environment

Newbie to pipenv,
TL;DR: Trying to integrate pipenv with a project using venv from PyCharm and getting unexpected dictionary behaviour
Background: Was Using PyCharm to make virtual environments for a Python project. I was recommended to move onto pipenv so the project could be run on different machines easier.
Followed procedure to install pipenv to my knowledge correctly:
pip3 install pipenv
Pipenv also seems to be working correctly when using sys.executable
/Users/swapneel/.local/share/virtualenvs/Desktop-zQLGYB_4/bin/python
Problem: When I run pipenv shell in my project directory everything is written to my desktop i.e Pipfile and Pipfile.lock.
I also tried to use my requirements.txt with:
pipenv install -r requirements.text
Only to get the message:
Requirements file provided! Importing into Pipfile…
Requirements file doesn't appear to exist. Please ensure the file exists in your project directory or you provided the correct path.
Also, this is what displays when I try activate pipenv in my desired directory:
(Desktop) bash-3.2$
Here is my directory path. For clarity I included undesired Pipfiles in desktop:
Desktop
|-Pipfile
|-Pipefile.lock
|--projects/
| |--desired project/
| |------------------__init__.py
| |------------------main.py
| |------------------requirements.txt
| |------------------modules
Any help would be greatly appreciated
EDIT:
Worth mentioning I was getting this error initially
Pipenv: Command Not Found' After 'pip install pipenv
which after some research
This seemed to fix
sudo -H pip install -U pipenv

`python -m venv foo` does not install pip inside the nested environment

I needed python3.7 for a project and it wasn't available as a ubuntu package, so I bootstrapped a python3.7 environment using conda. From that 'grandparent' environment, I created a 'parent' python3 virtual environment for the specific project.
From the parent environment in my project, I'm running a command line tool from the google-cloud-sdk which creates another test environment. That script creates a 'grandchild' environment by calling something equivalent to (parent) $ python3 -m venv /tmp/grandchild.
That grandchild environment doesn't have the pip binary installed, for some reason or another. And this is the problem. This missing pip causes the google script to fail to install dev-test dependencies. The parent, and the child do have pip installed, however, but pip doesn't get passed down.
When I take conda out of the picture, and rely only on the python that ships with my ubuntu package system (under /usr/lib), I can nest my virtual environments ad nauseam, and pip always seems to get inherited properly. I think this is something specific to python/pip conda environments that I'm tripping on.
I think this is a separate cause problem to this: pip missing from Python venv
(I don't have that file ~/.pydistutils.cfg anywhere on my box)
UPDATE:
I've found a way to reliably repro this, and without the need for conda. This happens when the parent is created with virtualenv, i.e. virtualenv parent, and the child gets created from that parent using -m venv, i.e. (parent) $ python3 -m venv child. The child then doesn't get pip copied into it.
Nesting environments created with virtualenv works fine, and nesting environments created with venv works well too, but not when venv is used within a virtualenv-created environnment. They don't mix.
Note: environments don't really "nest" per-se, they are independent copies. I mean that one is created from the other.
One workaround is to create all the environments with the same method.
e.g. use python3 -m venv for all environments along the chain.
python3 -m venv parent; source parent/bin/activate
(parent) $ python3 -m venv child
If that seems to tangle you into a web of symlinks, you may also provide the --copies flag: python3 -m venv --copies …, which can avoid that.

Create Virtual Environment using Python Documentation

I am very new at command line usage. I am using python 3.7.2, Bash and VSCode Integrated Terminal. I am trying to create a virtual environment using venv and following python documentation:
https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments
The command to use is this one:
$ python3 -m venv test-env
and I get:
bash: python3: command not found
Later I have found a similar answer in an stackoverflow post:
How to create and activate virtual environment in windows 10 using bash command
And I use the command:
py -m virtualenv test-env
and I get this:
No module named virtualenv
I am very new using the command line so i don´t really know what is going on and how to work it around.
Hi i can see that you are using two different tools to create your environment.
Those are "venv" and "virtualenv".
Venv is a library that already comes with your python installation.
Virtualenv is an external one.
I had the same problem before and the solution is very simple.
I recommend you to stick with venv because it works pretty ok and you don´t need to do extra job installing external libraries.
So for solving your problem the Bash Shell is telling you that the command Python3 has not been found.
So try instead just:
python -m venv test-env
Sometimes Python documentation is not accurate enough and I know when you start using commands, accuracy in the sintax is extremely important.
Try this steps,it'll helped you:
First, make a directory :
mkdir testing
Then, moved to this directory named testing :
cd testing
When you type following command in this directory:
python3 -m venv env (OR, python -m venv env)
You got error like :
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt install python3.8-venv
Type the following command but before that keep an eye on the version of python you installed on the machine; in my case its python3.8
sudo apt install python3.8-venv
Now, we can create a virtual environment and store its tools in the "bhandari" folder .
python3 -m venv bhandari
Note: you can named this "bhandari" folder; anyname you like( Standard practice is to name it "env" ...)
Now to activate your virtual environment, from the directory of your folder, type the following command this will activate our virtual environment in the “bhandari” folder
source bhandari/bin/activate
If you have successfully activated your virtual environment, you should see the (bhandari) word indicating that we are working in a virtual environment.
After this, we can install anything that will be isolated from the rest of the system....

How to fix Error: [Errno 2] No such file or directory: 'C:\\Program Files\\Python37\\lib\\venv\\scripts\\nt\\python_d.exe'

I'm using the latest version of Python on Windows and I'm trying to use venv with the following code:
C:\envs> py -m venv test
Even if it actually creates the venv, it returns this error and I don't understand why.
Moreover I can't activate the venv, the code
C:\envs> C:\envs\test\Scripts\activate.bat
returns
"C:\envs\test\Scripts\activate.bat" is not recognized as an internal or external command, operable program or batch file.
I am using python version 3.7.3 it gave me error states that "No such file or directory: 'C:\python37\lib\venv\scripts\nt\python_d.exe'" at the time of creation of project in pycharm.
I copied following files from python location(C:\Program Files\Python37) to the (C:\Program Files\Python37\Lib\venv\scripts\nt) and it worked for me
1) python_d.exe
2) python_d.pdb
3) pythonw_d.exe
4) pythonw_d.pdb
As Villani mentioned in his own comment, it's a debug binaries problem.
It will be fixed in the upcoming 3.7.4 release. (Planned for 24/06)
Either downgrade to 3.7.2 or install without debug binaries.
In Anaconda prompt type these commands:
conda remove anaconda
conda update python
conda list --show-channel-urls | findstr python
python -m venv venv
for me what fixed the issue was copying the python_d.exe and python_d.pdb from C:\Program Files\Python37 to C:\Program Files\Python37\Lib\venv\scripts\nt
hope this solves your problem ;)
The problem is , your virtual environment could not find debugger resources. The venv module's resources dont have those resources (probably a bug). The easy solution is.
Fix the venv module resources first: Copy debugger symbols to venv resources. In your python installation directory copy python_d.pdb, python_d.exe, pythonw_d.pdb, pythonw_d.exe and past inside (installation directory) Lib>venv>scripts>nt. In this nt folder should also have (already present) python.exe , python.pdb , pythonw.exe, pythonw.pdb
Now, try to create virtual environment using
python -m venv py37dev
These steps worked for me
conda update --force conda
conda update python
conda list --show-channel-urls | findstr python
python -m venv venv
I update python and bug fixed
conda update --force conda
conda remove anaconda
conda update python
python -m venv venv
This will resolve it but your main Python interpreter will run from the conda environment & it will prompt the error below but it will work just fine.
"This Python interpreter is in a conda environment, but the environment has
not been activated."

Resources