Issue
i want to have two version of a module, one version in pip(e.g:newer version) and the other(e.g: older version) in pipenv, but when i install a package using pipenv, it will also works with pip, i don't know how to create a different environment with pipenv in pycahrm IDE that the packages won't install in pip.
and also pycharm inform me this code every time i execute a command using pipenv:
Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPEN V_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
how can i set pipenv_ignore_virtualenvs to 1?
is it even possible to use two different enviroment at one time?
Solution
Basically, you can't, because it doesn't depend on pip (or pipenv or poetry) where the packages should be installed. Python will install packages wherever it's configured to do based on the values of sys.prefix
or sys.prefix_exec
, as explained here.
If you want to manage two different versions of a dependency, the one thing I can think of is having two separate virtual environments, each with its own dependencies. Then, you can switch between environments as you please. But you can't have two versions of the same package installed (unless you modify its source and install it locally as well) in the same environment, and definitely changing between pip or any dependency installation tool won't help you.
Here's a nice article that explains what happens when you activate a virtual environment and why it does not depend on pip where they are installed
Answered By - EDG956 Answer Checked By - Terry (WPSolving Volunteer)