GithubHelp home page GithubHelp logo

Comments (4)

carolyn-idi avatar carolyn-idi commented on June 8, 2024

FYI, if I uninstall pyenv-virtualenv then pyenv works again. No other changes were made to my .bash_profile, so something in pyenv-virtualenv seems to cause pyenv to ignore the local version that was set.

test2.7 >> pyenv local
2.7.6
test2.7 >> python
Python 2.7.6 (default, Jan 24 2014, 18:58:50) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.2.79)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

from pyenv-virtualenv.

yyuu avatar yyuu commented on June 8, 2024

I couldn't reproduced the behaviour. Because the pyenv-virtualenv depends on pyenv's shims mechanism, it will never touch the $PATH setting of user's shell.

It seems that the $PATH configuration of your shell is confused. Please review your $PATH setting and inspect the outputs from which python and pyenv which python.

from pyenv-virtualenv.

carolyn-idi avatar carolyn-idi commented on June 8, 2024

I'm really not sure how to resolve this to get it to work. pyenv is great, especially since I'm used to rbenv, but I'm having a tremendously hard time trying to get it to work with virtualenvs. Having separate environments in Ruby is so easy compared to Python - especially for someone new to how python works with virtual envs. I've spent a solid week on this and my boss is ready to kill me.

I've ultimately had to uninstall pyenv-virtualwrapper to get pyenv to work. Now I'm trying to use pyenv with the standard virtualenvwrapper - but I am still having issues with some of the settings, possibly because pyenv is using a non-standard setup (I guess).

This is the current error:

virtualenvwrapper.sh: There was a problem running the initialization hooks. 

If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON=“/usr/bin/python” and that PATH is
set properly.

How can I determine what the value for VIRTUALENVWRAPPER_PYTHON should be?
How can I configure virtualenvwrapper to work with pyenv?

I have been looking on tons of sites for hours and days and have been unable to find something that is clear on how to get this to work.

If I check which python is used I get the following results...

bin [master] >> which python
/usr/bin/python
bin [master] >> pyenv which python
/Users/insomniac/.pyenv/versions/2.7.6/bin/python

my .bash_profile has the following settings:

# Set  PYTHONPATH
export PYTHONPATH=/Users/insomniac/Repo/legion/tools/python/:Users/insomniac/Repo/pnp/python:/Volumes/legion/tools/python:/Volumes/legion/tools/python/site-packages:$PYTHONPATH


# Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:sbin:$PATH

# virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Repo
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv

# Load virtualenvwrapper after paths are set
if [[ -s /usr/local/bin/virtualenvwrapper.sh ]]; then
    source /usr/local/bin/virtualenvwrapper.sh
fi

Please help if you can.

Thanks,
C.

from pyenv-virtualenv.

carolyn-idi avatar carolyn-idi commented on June 8, 2024

OK, I think I found the problem, which was pretty simple, but could of been documented more clearly (for beginners).

You have to set the python version for a project with pyenv first.
pyenv local 3.3.3

Then you can use pyenv virutalenv to create the virtual environment.
pyenv virutalenv foo

Now things appear in sync:

>> pyenv local
3.3.3

>> pyenv virtualenvs
  foo (created from /Users/insomniac/.pyenv/versions/3.3.3)

>> which python
/Users/insomniac/.pyenv/shims/python

>> pyenv which python
/Users/insomniac/.pyenv/versions/3.3.3/bin/python

from pyenv-virtualenv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.