Coder Social home page Coder Social logo

Comments (10)

jkloetzke avatar jkloetzke commented on July 17, 2024

Hmm, this seems to work here:

jkloetzke@tuxedo:~/tmp$ virtualenv -p /usr/bin/python3 venv
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/jkloetzke/tmp/venv/bin/python3
Also creating executable in /home/jkloetzke/tmp/venv/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
jkloetzke@tuxedo:~/tmp$ source venv/bin/activate
(venv) jkloetzke@tuxedo:~/tmp$ 
(venv) jkloetzke@tuxedo:~/tmp/foo$ pip3 install schema
Collecting schema
  Downloading schema-0.6.5-py2.py3-none-any.whl
Installing collected packages: schema
Successfully installed schema-0.6.5
(venv) jkloetzke@tuxedo:~/tmp$ pip3 install python-magic
Collecting python-magic
Installing collected packages: python-magic
Successfully installed python-magic-0.4.12
(venv) jkloetzke@tuxedo:~/tmp/foo$ pip3 install pyyaml
Collecting pyyaml
  Downloading PyYAML-3.12.tar.gz (253kB)
    100% |████████████████████████████████| 256kB 787kB/s 
Building wheels for collected packages: pyyaml
  Running setup.py bdist_wheel for pyyaml ... done
  Stored in directory: /home/jkloetzke/.cache/pip/wheels/2c/f7/79/13f3a12cd723892437c0cfbde1230ab4d82947ff7b3839a4fc
Successfully built pyyaml
Installing collected packages: pyyaml
Successfully installed pyyaml-3.12
(venv) jkloetzke@tuxedo:~/tmp/foo$ cd
(venv) jkloetzke@tuxedo:~$ cd src/bob/bob
(venv) jkloetzke@tuxedo:~/src/bob/bob$ ./test/run-tests.sh 
~/src/bob/bob/test ~/src/bob/bob
..........................................................Cannot hash file: [Errno 2] No such file or directory: 'does-not-exist'
.
----------------------------------------------------------------------
Ran 59 tests in 0.238s

OK
~/src/bob/bob
Run test/blackbox/inherit
Run test/blackbox/multi-deps
Run test/blackbox/single
Run test/blackbox/string-plugin
Run test/generator
(venv) jkloetzke@tuxedo:~/src/bob/bob$ 

I've never used virtualenv before. I'm afraid I have no idea what could be the issue...

from bob.

kolewu avatar kolewu commented on July 17, 2024

Are you sure you don't have python-magic outside the venv? What is the result of the following outside the venv (use any needed package you want)?

python3 -c 'import magic'

And then maybe it's because I'm using the builtin pyvenv and not virtualenv (pyvenv is only available for python3, so inside the venv python and python3 are equivalent):

pyvenv /tmp/bob
source /tmp/bob/bin/activate
pip install pyyaml schema
test/run-tests.sh

Same error as above, even on another computer.

from bob.

kolewu avatar kolewu commented on July 17, 2024

Is there something special about the generator? Because on this new computer, I don't have PyYaml nor schema outside the venv but it's only complaining about magic.

from bob.

kolewu avatar kolewu commented on July 17, 2024

There must be something special about the magic package. If I insert import schema just before import magic the error is from not finding magic. But if I use non existing import schema2 it complains about this ...

from bob.

jkloetzke avatar jkloetzke commented on July 17, 2024

Now I see the error too. This module seems to be really special. I had to uninstall it from my normal installation (pip3 uninstall python-magic).

But this really seems to be related to how the test are working. Otherwise the module is functional. Outside the venv I get:

$ python3 -c 'import magic'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named 'magic'

Inside the venv it looks like its working:

(venv) jkloetzke@tuxedo:~/src/bob/bob$ python3 -c 'import magic'
(venv) jkloetzke@tuxedo:~/src/bob/bob$ 

In fact the qtcreator plugin actually works:

(venv) jkloetzke@tuxedo:~/tmp/foo$ bob project --list
qt-creator
(venv) jkloetzke@tuxedo:~/tmp/foo$ bob project qt-creator test-one/
>> test-one
   CHECKOUT  dev/src/test/1/workspace
   BUILD     skipped (unchanged input for dev/build/test-one/1/workspace)
   PACKAGE   skipped (unchanged input for dev/dist/test-one/1/workspace)
Build result is in dev/dist/test-one/1/workspace
>> test-one
   PROJECT   test-one/ (qt-creator)
(venv) jkloetzke@tuxedo:~/tmp/foo$

This triggers the import of the magic-module. So it does work. Well, except from inside run-tests.sh. I'm confused...

from bob.

kolewu avatar kolewu commented on July 17, 2024

Arrrrgh: As you can see, on the new computer, I haven't installed python-magic inside the venv.

With it installed, there only is an unexpected output from the shell script (see #38).

I have to find out, what's wrong with the other environment.

from bob.

kolewu avatar kolewu commented on July 17, 2024

Hmmm, so now you see the error but I no more 😞 What's wrong with the python world?

from bob.

jkloetzke avatar jkloetzke commented on July 17, 2024

😄 I thought the same too. I will have a look at it tomorrow again. I'm out of ideas for today...

from bob.

jkloetzke avatar jkloetzke commented on July 17, 2024

Ok, found it. 😄 The error that I see is related to coverage3. It's installed on my host (but not inside venv!) and the tests are picking it up. If I edit run-tests.sh to not use coverage3 then the test are running fine even inside venv. If I install the coverage module inside venv too then the tests are also fine with coverage enabled. Somehow the coverage instrumentation breaks this specific test when being installed on the host but not inside venv.

from bob.

kolewu avatar kolewu commented on July 17, 2024

I think it's because the shell doesn't know anything about the venv. Maybe the tests should be made into pure python -- or coverage can be called as a python module.

from bob.

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.