Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpmvenv failing and complaining about 'time' module not existing. #56

Closed
gustavooferreira opened this issue May 18, 2017 · 6 comments
Closed

Comments

@gustavooferreira
Copy link

gustavooferreira commented May 18, 2017

Hello,

When I run rpmvenv to package my python library I get a wierd error saying it was not possible to import the library 'time'.

Although if I create a virtual env myself and import time, it works just fine.

This is for CentOS Linux 7 (Core)

The json file, for now, is pretty basic (almost equal to the one in the example):

{
    "extensions": {
        "enabled": [
            "python_venv",
            "blocks"
        ]
    },
    "core": {
        "group": "Application/System",
        "license": "MIT",
        "name": "myRPM",
        "summary": "short package summary",
        "version": "1.0"
    },
    "python_venv": {
        "name": "venv",
        "path": "/usr/share/myPathRPM/"
    },
    "blocks": {
        "desc": [
            "some long package description",
            "each array element is a new line"
        ]
    }
}

And the output is:

[user@localhost ~]$ rpmvenv build.json 
There was an error generating the RPM.
The exit code was: 1.
The rpmbuild command was: rpmbuild -ba --define='_topdir /tmp/rpmvenvgduuy3rh' /tmp/rpmvenvgduuy3rh/SOURCES/package.spec.
The stderr was: b'+ umask 022
+ cd /tmp/rpmvenvgduuy3rh/BUILD
+ rm -rf \'/tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64/*\'
+ mkdir -p /tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64//usr/share/myPathRPM//venv
+ exit 0
+ umask 022
+ cd /tmp/rpmvenvgduuy3rh/BUILD
+ \'[\' /tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64 \'!=\' / \']\'
+ rm -rf /tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64
++ dirname /tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64
+ mkdir -p /tmp/rpmvenvgduuy3rh/BUILDROOT
+ mkdir /tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64
+ virtualenv --always-copy /tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64//usr/share/myPathRPM//venv
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python3.4/site-packages/virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "/usr/lib/python3.4/site-packages/virtualenv.py", line 945, in create_environment
    download=download,
  File "/usr/lib/python3.4/site-packages/virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "/usr/lib/python3.4/site-packages/virtualenv.py", line 797, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /tmp/rpmvenvgduuy3rh...M/venv/bin/python3.4 - setuptools pip wheel failed with error code 1
error: Bad exit status from /var/tmp/rpm-tmp.hbCgy8 (%install)
    Bad exit status from /var/tmp/rpm-tmp.hbCgy8 (%install)
'.
The stdout was: b'Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.tU518l
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.hbCgy8
Using base prefix \'/usr\'
Cannot find file lib (bad symlink)
New python executable in /tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64/usr/share/myPathRPM/venv/bin/python3.4
Also creating executable in /tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64/usr/share/myPathRPM/venv/bin/python
Installing setuptools, pip, wheel...
  Complete output from command /tmp/rpmvenvgduuy3rh...M/venv/bin/python3.4 - setuptools pip wheel:
  Traceback (most recent call last):
  File "<stdin>", line 4, in <module>
  File "/tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64/usr/share/myPathRPM/venv/lib64/python3.4/tempfile.py", line 34, in <module>
    import shutil as _shutil
  File "/tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64/usr/share/myPathRPM/venv/lib64/python3.4/shutil.py", line 14, in <module>
    import tarfile
  File "/tmp/rpmvenvgduuy3rh/BUILDROOT/myRPM-1.0-1.x86_64/usr/share/myPathRPM/venv/lib64/python3.4/tarfile.py", line 47, in <module>
    import time
ImportError: No module named \'time\'
----------------------------------------
...Installing setuptools, pip, wheel...done.


RPM build errors:
'.

Any help please?

Thank you!

@gustavooferreira gustavooferreira changed the title rpmvenv failing rpmvenv failing complaining about 'time' module not existing. May 18, 2017
@gustavooferreira gustavooferreira changed the title rpmvenv failing complaining about 'time' module not existing. rpmvenv failing and complaining about 'time' module not existing. May 18, 2017
@gustavooferreira
Copy link
Author

UPDATE:

I tried the same thing in Fedora 25 and got a similar error, but this time it is complaining about not finding the math module.

@kevinconway
Copy link
Owner

Does the same error occur if you manually run virtualenv with the same --always-copy flag that rpmvenv uses? I believe this may actually be a bug in the recent release of virtualenv. Reference: pypa/virtualenv#565

@gustavooferreira
Copy link
Author

gustavooferreira commented May 19, 2017

You are right!

Just tried to create a virtual env with the --always-copy flag, got the same error.

So, in theory, I should just downgrade the version of virtualenv then.

PS: Thank you very much for such quick response!

EDIT: Hum, this issue with virtualenv was reported 3 years ago. Not sure if downgrading virtualenv is what I want.
EDIT2: If this is an issue that has been around for 3 years, how have you managed to package your stuff?

@kevinconway
Copy link
Owner

The issue appears to be with the default system Python. I am able to recreate the failure you are seeing consistently in CentOS 6 and 7 when using the pre-installed Python. However, if you build the same version of Python from source and install it on the system then the problem goes away.

I've not personally encountered this issue as the organisations I work with typically build and install specific Python versions rather than relying on the system default. As far as I can tell, the default Python installation on CentOS, Fedora, and RedHat are different enough in some way from what virtualenv expects that they simply do not work.

@gustavooferreira
Copy link
Author

You were right.

Indeed I can generate RPM packages with a custom installation of Python.

Thank you for your help, you may want to close this ticket now since it has nothing to do with your tool.

PS: Thank you for developing such nice tool and for an amazing support!

@kevinconway
Copy link
Owner

I'm glad we could figure it out! Let me know if you have any more trouble.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants