Auto activate virtual environment in Visual Studio Code

This is how I did it in 2021: Enter Ctrl+Shift+P in your vs code. Locate your Virtual Environment: Python: select interpreter > Enter interpreter path > Find Once you locate your virtual env select your python version: your-virtual-env > bin > python3. Now in your project you will see .vscode directory created open settings.json inside … Read more

PyCharm cannot find the packages in virtualenv

The problem may lay in PyCharm picking up faulty ‘Interpreter Paths’ for your virtual environment. Go here: PyCharm (menu) -> Preferences (Menu option) -> Project: <name> (Dropdown) -> Project Interpreter (Menu option) -> ‘Settings’ button (Looks like a gear) -> More (Menu option) -> Select your virtualenv interpreter -> Click ‘Show paths for interpreter’ button … Read more

virtualenv Env not creating bin directory in Windows 7

On Windows, this is entirely correct. A bin directory is created on POSIX systems only. From the Windows Notes section of the documentation: Some paths within the virtualenv are slightly different on Windows: scripts and executables on Windows go in ENV\Scripts\ instead of ENV/bin/ and libraries go in ENV\Lib\ rather than ENV/lib/. For Windows, run … Read more

Is that a bad idea to use conda and pip install on the same environment?

Don’t mix conda install and pip install within conda environment. Probably, decide to use conda or virtualenv+piponce and for all. And here is how you decide which one suits you best: Conda installs various (not only python) conda-adopted packages within conda environment. It gets your environments right if you are into environments. Pip installs python … Read more

How do I change the default virtualenv prompt?

If you are working on a custom PS1 (as I when found out this issue), I recommend you to disable prompt change, use export VIRTUAL_ENV_DISABLE_PROMPT=1 (see virtualenv docs), and make your own virtualenv prompt in order to add to your PS1. See this snippet that I’ve used: function virtualenv_info(){ # Get Virtual Env if [[ … Read more

Poetry doesn’t use the correct version of Python

pyproject.toml is used to define all the dependencies for your project, including the supported python version. The line your complaining about is just saying that the versions of python supported by the project is python2.7 or greater, this is independent of what versions of python you’ve installed with pyenv. python = “^2.7” If you want … Read more

Upgrade package without upgrading dependencies using pip?

Overview: Install new packages without upgrading installed ones: pip install (without -U) Upgrade only packages that are outdated according to requirements: pip install –upgrade –upgrade-strategy only-if-needed (default in new versions) Upgrade package and all dependencies to latest version: pip install –upgrade –upgrade-strategy eager (default in old versions) Install or upgrade listed packages without touching dependencies: … Read more

ImportError: cannot import name ‘html5lib’ from ‘pip._vendor’ (/usr/lib/python3/dist-packages/pip/_vendor/__init__.py) [duplicate]

If you have faced this error please refer to this answer. In order to save your time, I will post what I have done to solve the issue. Install the latest pip with the following command: curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)