I am following the following link to install RASA on my system: https://github.com/RasaHQ/rasa But unfortunately while trying to install the dependencies or any of the following poetry commands which are written in Makefile,
$poetry run
$poetry install
I am getting following error:
Seems like there is some issue in virtual environment setup but don't know how I can fix. Following is the stack trace:
$ make install
poetry run python -m pip install -U 'pip<20'
The virtual environment found in /home/kamaldeep/.cache/pypoetry/virtualenvs/rasa-LHgLSZoI-py3.6 seems to be broken.
Recreating virtualenv rasa-LHgLSZoI-py3.6 in /home/kamaldeep/.cache/pypoetry/virtualenvs/rasa-LHgLSZoI-py3.6
[CalledProcessError]
Command '['/home/kamaldeep/.cache/pypoetry/virtualenvs/rasa-LHgLSZoI-py3.6/bin/python', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1.
Makefile:43: recipe for target 'install' failed
make: *** [install] Error 1
Poetry is also bound to the pyproject. toml file and its path to generate a new environment. poetry will create a new virtual environment but this is not exactly the same as changing just some project deps. This will generate a new environment with just the asked dependencies changed.
The easiest way to activate the virtual environment is to create a new shell with poetry shell . To deactivate the virtual environment and exit this new shell type exit . To deactivate the virtual environment without leaving the shell use deactivate .
A virtual environment is simply a tool that separates the dependencies of different projects by creating a separate isolated environment for each project. These are simply the directories so that unlimited virtual environments can be created.
Deleting the environments You can delete more than one environment at a time. Use the --all option to delete all virtual environments at once.
In case if you get error of broken virtual environment like
The virtual environment found in /home/kamaldeep/.cache/pypoetry/virtualenvs/rasa-LHgLSZoI-py3.7 seems to be broken
Then install venv in the respective python package like python3.6, python3.5. In my case, I am using python 3.7
sudo apt-get install python3.7-venv
Other way is to disable virtual environment
poetry config virtualenvs.create false
Kamaldeep Singh's answer was what I needed: sudo apt-get install python3.7-venv
.
A couple of details to add to complete the process (this is for those like me who aren't so comfortable juggling package versions and are also perhaps new to using Poetry) (adjust for the Python version you want to work with):
Go to your project directory and start Poetry (if you're not already there); get rid of the broken virtual environment,
cd your_project_directory
poetry shell
poetry env remove python3.7
Leave Poetry (I found Poetry got muddled otherwise),
exit
Did you already install python3.7-venv
as per Kamaldeep Singh's answer? Do it now if not (assuming you're on a Debian/Ubuntu-based system),
sudo apt install python3.7-venv
Re-enter Poetry,
poetry shell
Recreate the environment now that python3.7-venv
is installed,
poetry env use python3.7
Add required dependencies for your project,
poetry install
That's it, you should now be ready to work on your project in the new Python version. Poetry CLI documentation for more options...
(update: One bit of strangeness: I found exiting and re-entering poetry shell
one more time after poetry install
was necessary for pytest
to be found. This leave Poetry and re-enter it step (again) feels very clumsy, maybe someone here can explain why that might be necessary in comments?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With