virtualenv env bash: virtualenv: command not found - python

I have a problem each time I want to start my VM even after Installing on windows
`
$ pip install virtualenv
Collecting virtualenv
Using cached virtualenv-20.16.6-py3-none-any.whl (8.8 MB)
Requirement already satisfied: platformdirs<3,>=2.4 in c:\users\samib\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from virtualenv) (2.5.2)
Requirement already satisfied: distlib<1,>=0.3.6 in c:\users\samib\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from virtualenv) (0.3.6)
Requirement already satisfied: filelock<4,>=3.4.1 in c:\users\samib\appdata\local\packages\pythonsoftwarefoundation.python.3.10_qbz5n2kfra8p0\localcache\local-packages\python310\site-packages (from virtualenv) (3.8.0)
Installing collected packages: virtualenv
WARNING: The script virtualenv.exe is installed in 'C:\Users\samib\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed virtualenv-20.16.6
`
I have the error
virtualenv env bash: virtualenv: command not found
I tried to uninstall and install again but I have the same issue

Related

Spyder (pip installed) doesn't start anymore with the error: undefined symbol: _ZdaPvm, version QT_5

On Ubuntu 22.04 (5.15.0-43-generic) I freshly updated spyder using pip as follow:
$ sudo -H pip3 install --upgrade spyder
everything went fine, but it throws this error when I start spyder now:
$ spyder
Traceback (most recent call last):
File "/usr/local/bin/spyder", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/spyder/app/start.py", line 248, in main
from spyder.app import mainwindow
File "/usr/local/lib/python3.10/dist-packages/spyder/app/mainwindow.py", line 57, in <module>
from qtpy import QtWebEngineWidgets # analysis:ignore
File "/usr/local/lib/python3.10/dist-packages/qtpy/QtWebEngineWidgets.py", line 29, in <module>
from PyQt5.QtWebEngineWidgets import QWebEnginePage
ImportError: /usr/local/lib/python3.10/dist-packages/PyQt5/Qt5/lib/libQt5Network.so.5: undefined symbol: _ZdaPvm, version Qt_5
Some more info:
$ python3 --version
Python 3.10.4
$ pip list | grep -i pyqt
PyQt5 5.15.6
PyQt5-Qt5 5.15.2
PyQt5-sip 12.11.0
PyQtWebEngine 5.15.5
PyQtWebEngine-Qt5 5.15.2
$ pip list | grep -i spyder
pyls-spyder 0.4.0
spyder 5.3.2
spyder-kernels 2.3.2
And I'm not able to uninstall PyQt5:
$ sudo -H pip uninstall pyqt5
Found existing installation: PyQt5 5.15.6
ERROR: Cannot uninstall PyQt5 5.15.6, RECORD file not found. Hint: The package was installed by sip-build.
The last line being printed in red in the terminal.
From that point, I'm not able to find relevant information on how to debug this in order to make spyder work again.
What could I do to fix this error?
Have you looked at this? This is exactly why you shouldn't use sudo pip install. Library versions get borked, inconsistencies arise, and stuff doesn't work.
Use sudo pip (for the last time) to uninstall Spyder and PyQT5, then reinstall the relevant packages using apt. Finally, upgrade Spyder using pip install --user (no sudo!). Everything should work okay after that.
Okay, this fixed it for me:
$ sudo -H pip3 install --force-reinstall spyder
it will probably throw some errors such as:
Attempting uninstall: PyQtWebEngine
Found existing installation: PyQtWebEngine 5.15.5
ERROR: Cannot uninstall PyQtWebEngine 5.15.5, RECORD file not found. Hint: The package was installed by sip-build.
which, if you try to update it individually will show:
$ sudo -H pip3 install -U PyQtWebEngine
Requirement already satisfied: PyQtWebEngine in /usr/lib/python3/dist-packages (5.15.5)
Collecting PyQtWebEngine
Using cached PyQtWebEngine-5.15.6-cp37-abi3-manylinux1_x86_64.whl (230 kB)
Requirement already satisfied: PyQt5>=5.15.4 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (5.15.7)
Requirement already satisfied: PyQtWebEngine-Qt5>=5.15.0 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (5.15.2)
Requirement already satisfied: PyQt5-sip<13,>=12.11 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (12.11.0)
Requirement already satisfied: PyQt5-Qt5>=5.15.0 in /usr/local/lib/python3.10/dist-packages (from PyQt5>=5.15.4->PyQtWebEngine) (5.15.2)
Installing collected packages: PyQtWebEngine
Attempting uninstall: PyQtWebEngine
Found existing installation: PyQtWebEngine 5.15.5
ERROR: Cannot uninstall PyQtWebEngine 5.15.5, RECORD file not found. Hint: The package was installed by sip-build.
Therefore, in that case, run the installation using the --ignore-installed flag on the incriminated package, which should install it without any trouble:
$ sudo -H pip3 install --ignore-installed PyQtWebEngine
Collecting PyQtWebEngine
Using cached PyQtWebEngine-5.15.6-cp37-abi3-manylinux1_x86_64.whl (230 kB)
Collecting PyQtWebEngine-Qt5>=5.15.0
Using cached PyQtWebEngine_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (67.5 MB)
Collecting PyQt5>=5.15.4
Using cached PyQt5-5.15.7-cp37-abi3-manylinux1_x86_64.whl (8.4 MB)
Collecting PyQt5-sip<13,>=12.11
Using cached PyQt5_sip-12.11.0-cp310-cp310-manylinux1_x86_64.whl (359 kB)
Collecting PyQt5-Qt5>=5.15.0
Using cached PyQt5_Qt5-5.15.2-py3-none-manylinux2014_x86_64.whl (59.9 MB)
Installing collected packages: PyQtWebEngine-Qt5, PyQt5-Qt5, PyQt5-sip, PyQt5, PyQtWebEngine
Successfully installed PyQt5-5.15.7 PyQt5-Qt5-5.15.2 PyQt5-sip-12.11.0 PyQtWebEngine-5.15.6 PyQtWebEngine-Qt5-5.15.2
After what the above-mentioned error will never show up again. Here as an example:
$ sudo -H pip3 install -U PyQtWebEngine
Requirement already satisfied: PyQtWebEngine in /usr/local/lib/python3.10/dist-packages (5.15.6)
Requirement already satisfied: PyQtWebEngine-Qt5>=5.15.0 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (5.15.2)
Requirement already satisfied: PyQt5-sip<13,>=12.11 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (12.11.0)
Requirement already satisfied: PyQt5>=5.15.4 in /usr/local/lib/python3.10/dist-packages (from PyQtWebEngine) (5.15.7)
Requirement already satisfied: PyQt5-Qt5>=5.15.0 in /usr/local/lib/python3.10/dist-packages (from PyQt5>=5.15.4->PyQtWebEngine) (5.15.2)
Repeat the same procedure for all offending packages.
Finally update spyder:
$ sudo -H pip3 install --force-reinstall spyder
And voila. A working spyder should be available.
As an aside: please note the -H option after sudo. This install packages under /usr/local/lib/python3.xx/dist-packages which will normally not conflict with apt system wide installed packages (which are under /usr/lib/python3/dist-packages) and which you definitely don't want to touch another what than with apt actually!
I'm using this to avoid installing the same packages on a user-basis by invoking pip without sudo, which will install them under ~/.local/lib/python3.10/site-packages/ for every user on the machine.

Create Virtual Environment The system cannot find the path specified

I want to active venv in new folder , when i write "D:\pythonproject\first_django>env\Scripts\activate" in cmd I get " The system cannot find the path specified."
also I installed venv , when I run this command "pip install virtualenv" in cmd get "Requirement already satisfied: virtualenv in c:\users\sam\appdata\local\programs\python\python310\lib\site-packages (20.13.0)
Requirement already satisfied: filelock<4,>=3.2 in c:\users\sam\appdata\local\programs\python\python310\lib\site-packages (from virtualenv) (3.4.2)
Requirement already satisfied: distlib<1,>=0.3.1 in c:\users\sam\appdata\local\programs\python\python310\lib\site-packages (from virtualenv) (0.3.4)
Requirement already satisfied: six<2,>=1.9.0 in c:\users\sam\appdata\local\programs\python\python310\lib\site-packages (from virtualenv) (1.16.0)
Requirement already satisfied: platformdirs<3,>=2 in c:\users\sam\appdata\local\programs\python\python310\lib\site-packages (from virtualenv) (2.4.1)"
can any one tell me what's problem?
I use win11 and python 3.10
Follow the below steps :
To create virtual environment
py -m venv env
To activate it
env\scripts\activate
Then proceed with your pip installations in a virtual environment.

Why Python repo is not installed in WSL?

From my WSL terminal
pip install schemathesis
Requirement already satisfied: schemathesis in /home/milenko/.local/lib/python3.8/site-packages (3.9.7)
Requirement already satisfied: hypothesis_jsonschema>=0.20.1 in /home/milenko/.local/lib/python3.8/site-packages (from schemathesis) (0.20.1)
Requirement already satisfied: requests<3.0,>=2.22 in /usr/lib/python3/dist-packages (from schemathesis) (2.22.0)
Requirement already satisfied: pytest>4.6.4 in /home/milenko/.local/lib/python3.8/site-packages (from schemathesis) (6.2.5)
Requirement already satisfied: pytest-subtests<1.0,>=0.2.1 in /home/milenko/.local/lib/python3.8/site-packages (from schemathesis) (0.5.0)
When I try
:/mnt/c/Users/v-mimaholmes$ schemathesis
I got
schemathesis: command not found
If I try what Tzane suggested
python3 -m schemathesis
/usr/bin/python3: No module named schemathesis.__main__; 'schemathesis' is a package and cannot be directly executed
Outout from pip freeze
requests-unixsocket==0.2.0
schemathesis==3.9.7
SecretStorage==2.3.1
Why?
I do not have .local/lib.
On WSL the install location for the schemathesis -script is not in $PATH as Shinra tensei correctly assumed. I tried installing it myself on WSL Ubuntu and got the following:
The script schemathesis is installed in '/home/taneli/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
and got the same error as you. After adding ~/.local/bin to $PATH it now works as intended:
export PATH=$PATH:~/.local/bin
Not a linux wizard so I followed this about the appending to $PATH: https://unix.stackexchange.com/a/26059

Can't install new packages or list existing packages in virtual environment with pip

Update / Solution:
Found a fix/workaround in the answer to this question:
Pip installing packages to global site-packages when inside virtual environment.
Like the OP of that question, I'm also running Manjaro Linux with the latest updates.
When trying to install the django import_export module with pip install django-import-export into my virtual environment, it indicates that it was successfully installed, however, when I try to use the import_export module in my project, I receive an error: ModuleNotFoundError: No module named 'import_export'. I'm also unable to list any previously installed apps with pip list or pip freeze, and trying to upgrade the pip version using pip install --upgrade pip also says the new version is successfully installed, but isn't installed within my virtual environment.
I've made sure to activate my virtual environment with source /home/travis/Documents/Python/Django/Projects/issuetracker/.env/bin/activate.
Output from pip install django-import-export:
(.env) [travis#spooky issuetracker]$ pip install django-import-export
Collecting django-import-export
Using cached https://files.pythonhosted.org/packages/62/7a/ddd9aef718243504e7715bda9bb5a100cfc353be37dc819d9914a7073cba/django_import_export-1.2.0-py2.py3-none-any.whl
Collecting tablib (from django-import-export)
Using cached https://files.pythonhosted.org/packages/7b/c7/cb74031b330cd94f3580926dc707d148b4ba9138449fc9f433cb79e640d8/tablib-0.13.0-py3-none-any.whl
Collecting diff-match-patch (from django-import-export)
Using cached https://files.pythonhosted.org/packages/f0/2a/5ba07def0e9107d935aba62cf632afbd0f7c723a98af47ccbcab753d2452/diff-match-patch-20181111.tar.gz
Requirement already satisfied: django>=1.8 in ./.env/lib/python3.7/site-packages (from django-import-export) (2.2.4)
Collecting openpyxl>=2.4.0 (from tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/f5/39/942a406621c1ff0de38d7e4782991b1bac046415bf54a66655c959ee66e8/openpyxl-2.6.3.tar.gz
Collecting xlwt (from tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/44/48/def306413b25c3d01753603b1a222a011b8621aed27cd7f89cbc27e6b0f4/xlwt-1.3.0-py2.py3-none-any.whl
Collecting xlrd (from tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/b0/16/63576a1a001752e34bf8ea62e367997530dc553b689356b9879339cf45a4/xlrd-1.2.0-py2.py3-none-any.whl
Collecting backports.csv (from tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/8e/26/a6bd68f13e0f38fbb643d6e497fc3462be83a0b6c4d43425c78bb51a7291/backports.csv-1.0.7-py2.py3-none-any.whl
Collecting odfpy (from tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/85/7d/8f6d1f2a4683be362b101c00232b4c3839e4e4a90e0945d8d43ec6aa671d/odfpy-1.4.0.tar.gz
Collecting pyyaml (from tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/e3/e8/b3212641ee2718d556df0f23f78de8303f068fe29cdaa7a91018849582fe/PyYAML-5.1.2.tar.gz
Requirement already satisfied: sqlparse in ./.env/lib/python3.7/site-packages (from django>=1.8->django-import-export) (0.3.0)
Requirement already satisfied: pytz in ./.env/lib/python3.7/site-packages (from django>=1.8->django-import-export) (2019.2)
Collecting jdcal (from openpyxl>=2.4.0->tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/f0/da/572cbc0bc582390480bbd7c4e93d14dc46079778ed915b505dc494b37c57/jdcal-1.4.1-py2.py3-none-any.whl
Collecting et_xmlfile (from openpyxl>=2.4.0->tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/22/28/a99c42aea746e18382ad9fb36f64c1c1f04216f41797f2f0fa567da11388/et_xmlfile-1.0.1.tar.gz
Collecting defusedxml (from odfpy->tablib->django-import-export)
Using cached https://files.pythonhosted.org/packages/06/74/9b387472866358ebc08732de3da6dc48e44b0aacd2ddaa5cb85ab7e986a2/defusedxml-0.6.0-py2.py3-none-any.whl
Installing collected packages: jdcal, et-xmlfile, openpyxl, xlwt, xlrd, backports.csv, defusedxml, odfpy, pyyaml, tablib, diff-match-patch, django-import-export
Running setup.py install for et-xmlfile ... done
Running setup.py install for openpyxl ... done
Running setup.py install for odfpy ... done
Running setup.py install for pyyaml ... done
Running setup.py install for diff-match-patch ... done
Successfully installed backports.csv-1.0.7 defusedxml-0.6.0 diff-match-patch-20181111 django-import-export-1.2.0 et-xmlfile-1.0.1 jdcal-1.4.1 odfpy-1.4.0 openpyxl-2.6.3 pyyaml-5.1.2 tablib-0.13.0 xlrd-1.2.0 xlwt-1.3.0
WARNING: You are using pip version 19.2.2, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Python version:
(.env) [travis#spooky issuetracker]$ python -V
Python 3.7.4
Pip version:
(.env) [travis#spooky issuetracker]$ pip -V
pip 19.2.2 from /home/travis/Documents/Python/Django/Projects/issuetracker/.env/lib/python3.7/site-packages/pip (python 3.7)
.env/bin/pip:
#!/home/travis/Documents/Python/Django/Projects/issuetracker/.env/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from pip._internal import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
I'm not sure when this stopped working, since I was previously able to successfully install other packages into the same virtual environment. How can I ensure that pip is installing packages correctly into my virtual environment?
Update:
It seems that pip is installing into the .local/lib/python3.7/site-packages directory instead of .env/lib/python3.7/site-packages.
Found a fix/workaround in the answer to this question:
Pip installing packages to global site-packages when inside virtual environment
Like the OP of that question, I'm also running Manjaro Linux with the latest updates.

Module path order in virtualenv

I noticed a strange phenomenon related to dist-packages paths. The order of my paths in my system-wide installation of python 3 (simply running python3 and then printing sys.path) is as follows:
/usr/local/lib/python3.4/dist-packages
/usr/lib/python3/dist-packages
i.e. the path in local is preferred. However, creating a virtual environment and running python3 after activating the environment gives:
/usr/lib/python3/dist-packages
/usr/local/lib/python3.4/dist-packages
The order is clearly reversed. Yet, pip still searches local first, which results in a different version of a library seen by pip dependencies and a different one used when importing.
Can someone explain the discrepancy?
EDIT:
When the virtualenv is activated, the pip used is the one installed in the virtualenv:
pip 9.0.1 from ~/.virtualenv/python3/lib/python3.4/site-packages (python 3.4)
and yet, despite the path pointing first to dist-utils in /usr/lib, it does resolve dependencies with what's in /usr/local/lib:
pip3 install --upgrade setuptools
Requirement already up-to-date: setuptools in ./.virtualenv/python3/lib/python3.4/site-packages
Requirement already up-to-date: appdirs>=1.4.0 in ./.virtualenv/python3/lib/python3.4/site-packages (from setuptools)
Requirement already up-to-date: packaging>=16.8 in /usr/local/lib/python3.4/dist-packages (from setuptools)
Requirement already up-to-date: six>=1.6.0 in ./.virtualenv/python3/lib/python3.4/site-packages (from setuptools)
Requirement already up-to-date: pyparsing in /usr/local/lib/python3.4/dist-packages (from packaging>=16.8->setuptools)

Categories

Resources