Quantcast
Channel: Mandalika's scratchpad
Viewing all articles
Browse latest Browse all 115

pip error: Could not find an activated virtualenv (required)

$
0
0

Running pip commands encounter Could not find an activated virtualenv (required) error. Some of the options to get around this error are discussed in this blog post.

eg.,


# pip uninstall oci
ERROR: Could not find an activated virtualenv (required).

Try running the failed command by setting PIP_REQUIRE_VIRTUALENV to false. If the command succeeds and you don't want to encounter the same error in future, consider saving this environment variable in user's profile.


# PIP_REQUIRE_VIRTUALENV=false pip uninstall oci
Found existing installation: oci 2.18.0
Uninstalling oci-2.18.0:
Would remove:
/usr/lib/python2.7/site-packages/oci-2.18.0.dist-info/*
/usr/lib/python2.7/site-packages/oci/*
Proceed (y/n)?

Another option is to run pip in isolated mode that ignores environment variables and user configuration.

# pip --isolated uninstall oci

Be aware that running in isolated mode won't ignore global configuration but only the user configuration. Therefore if there is a global configuration (say /etc/pip.conf) with a setting that forces virtual environment, --isolated option won't help.

eg.,


# pip --isolated uninstall oci
ERROR: Could not find an activated virtualenv (required).

In this case, examine global configuration by listing active configuration.


# pip config list
global.require-virtualenv='true'

Find out where the active configuration was loaded from by running pip with --verbose or -v (verbose) option.


# pip config list -v
For variant 'global', will try loading '/etc/xdg/pip/pip.conf'
For variant 'global', will try loading '/etc/pip.conf'
For variant 'user', will try loading '/root/.pip/pip.conf'
For variant 'user', will try loading '/root/.config/pip/pip.conf'
For variant 'site', will try loading '/usr/pip.conf'
global.require-virtualenv='true'

Finally edit global configuration to turn off the virtual environment requirement, and run the target pip command.

If editing the global configuration is not a viable option, consider ignoring global configuration tentatively while running target pip command(s).

eg.,


# PIP_CONFIG_FILE=/dev/null pip uninstall oci
Found existing installation: oci 2.18.0
Uninstalling oci-2.18.0:
Would remove:
/usr/lib/python2.7/site-packages/oci-2.18.0.dist-info/*
/usr/lib/python2.7/site-packages/oci/*
Proceed (y/n)?

Viewing all articles
Browse latest Browse all 115

Trending Articles