Giter VIP home page Giter VIP logo

Comments (6)

crdoconnor avatar crdoconnor commented on August 23, 2024

Hi Eraldo,

Thanks for trying. You're actually the first person who has tried it on El Capitan and reported back. I was worried there might be problems on that environment :/

The problem looks like it might be related to this: https://stackoverflow.com/questions/16460313/pip-could-not-find-an-activated-virtualenv-required

Do you have the environment variable PIP_REQUIRE_VIRTUALENV=true ?

If it is, could you try setting it to false, doing pip install --upgrade hitch (with the system python) and then do:

hitch cleanpkg
hitch clean
hitch test .

P.S. Hitch sets up virtualenvs for you - it creates one for the testing environment and creates another one for your code. There's no need to use virtualenvwrapper or virtualenv yourself.

from hitch.

Eraldo avatar Eraldo commented on August 23, 2024

Yes, PIP_REQUIRE_VIRTUALENV is set to true for my system python.
I do syspip install if I want to force an install into my system python.

In general I want to stay away from installing packages into my osx system python (2.7), thus keeping it clean and preferring to use the pyenv python versions and or virtual environments.

Running syspip install --upgrade hitch gives me:

Requirement already up-to-date: hitch in /usr/local/var/lib/pyenv/versions/3.4.1/lib/python3.4/site-packages
Cleaning up...

Using..

eraldo@EroBookPro:~$ pyenv version
3.4.1 (set by /usr/local/opt/pyenv/version)

Is there a way to make hitch use pyenv or the virtualenv version instead?
Or .. unset the variable locally within it's installed python?
=> So that I still do not accidentally install requirement files into the system python. (the reason for setting the variable to true)

Thank's for the fast reply @crdoconnor .. I appreciate it since I did not find other people talking about it. :D

from hitch.

crdoconnor avatar crdoconnor commented on August 23, 2024

Yes, PIP_REQUIRE_VIRTUALENV is set to true for my system python.

Ok, that's probably it.

In general I want to stay away from installing packages into my osx system python (2.7), thus keeping it clean and preferring to use the pyenv python versions and or virtual environments.

Understood, and 99% of the time that's the right approach. The hitch bootstrap script, however, is tiny, clean, tested on all versions of python and doesn't have any dependencies.

All it really does is set up a python 3 virtualenv and run stuff in that virtualenv.

Is there a way to make hitch use pyenv or the virtualenv version instead?

That hitch python 3 virtualenv I talked about bundles pyenv. It downloads whichever version of python you specify in your test and installs it into ~/.hitchpkg. From that it creates a virtualenv to run your application code in in the .hitch directory.

That's what these two lines do in engine.py::

python_package = hitchpython.PythonPackage(version=2.7.6)
python_package.build()

Then:

python_package.python = "/path/to/your/new/project/virtualenv/python"

It's all a bit indirect and complicated but doing it this way largely means that your system python is isolated from your test python which is in turn isolated from the python used to run your code. Keeping them apart cuts down on quirky unexpected behavior in all environments.

Or .. unset the variable locally within it's installed python?

You can unset the variable just for one command like so::

PIP_REQUIRE_VIRTUALENV=false hitch init
PIP_REQUIRE_VIRTUALENV=false hitch test .

Thank's for the fast reply @crdoconnor .. I appreciate it since I did not find other people talking about it. :D

No worries. Thank you very much for reporting the issue. I wouldn't have picked up on it otherwise. Please, next time if you're confused, don't spend hours debugging. I'm pretty keen to fix stuff that's just confusing as well as outright bugs like this.

from hitch.

Eraldo avatar Eraldo commented on August 23, 2024

Update: (workaround)

I added export PIP_REQUIRE_VIRTUALENV=false to the postactivation hook of my virtual environment for that project.
This way.. hitch works and my system stays clean when not working on that project.
Changing the variable within the project is okay for me since the project's virtual environment uses another pyenv than the system one. So in the worst case I am cluttering a custom installed python version and not the true system version.

from hitch.

crdoconnor avatar crdoconnor commented on August 23, 2024

Did everything work after you did that?

from hitch.

Eraldo avatar Eraldo commented on August 23, 2024

Yes, this workaround works.

from hitch.

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.