#700 module_build_service failed by PIP install from source.
Closed Opened by jaruga.

I tried to install module_build_service from latest master branch's source to run latest version of it.

Right now on f25, module-build-service-1.3.26-3 is latest version, And master branch is 1.3.29.

And it was failed to install from source on Python 3.6 and Python 2.7.

Could you fix this?
And could you update module_build_service's setup.py Programming Language :: Python :: FOO to show which Python version is supported, explicitly like below file?
https://github.com/pypa/pip/blob/master/setup.py#L49-L56

$ git clone https://pagure.io/fm-orchestrator.git
$ cd fm-orchestrator

Python 3.6.2

$ python3 --version
Python 3.6.2
$ python3 -m venv ./venv
$ source venv/bin/activate
(venv) $ pip install -e .
...
Collecting qpid-python (from module-build-service==1.3.29)
  Using cached qpid-python-1.36.0-1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-mkiln1qi/qpid-python/setup.py", line 42
        raise DistutilsFileError, \
                                ^
    SyntaxError: invalid syntax
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-mkiln1qi/qpid-python/
(venv) $ deactive

Python 2.7.13

$ python --version
Python 2.7.13
$ virtualenv --python=python ./venv2
$ source venv2/bin/activate
(venv2) $ pip install -e .
...
  swig -python -I/usr/include/python2.7 -I/usr/include -includeall -noproxy -o swig/m2ext_wrap.c swig/m2ext.i
  unable to execute 'swig': No such file or directory
  error: command 'swig' failed with exit status 1
  ----------------------------------------
  Failed building wheel for m2ext
...
Command "/home/jaruga/git/fedora-modularity/fm-orchestrator/venv2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Vn7u8W/m2ext/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-8AixAS-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/jaruga/git/fedora-modularity/fm-orchestrator/venv2/include/site/python2.7/m2ext" failed with error code 1 in /tmp/pip-build-Vn7u8W/m2ext/
(venv2) $ deactivate 

For python2, try installing swig with dnf (odds are you're going to need a few other things too).

@ralph thanks for the info.

After installing sudo dnf install swig on Python2, the install was succeeded.
But there is a error to run mbs-build command.
I guess requirements.txt needs koji, isn't it?

(venv2) $ which mbs-build
/home/jaruga/git/fedora-modularity/fm-orchestrator/venv2/bin/mbs-build
(venv2) $ mbs-build --help
Traceback (most recent call last):
  File "/home/jaruga/git/fedora-modularity/fm-orchestrator/venv2/bin/mbs-build", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/jaruga/git/fedora-modularity/fm-orchestrator/contrib/mbs-build", line 10, in <module>
    import koji
ImportError: No module named koji

Ah koji does not exist in PyPI.
https://pagure.io/koji/tree/master

I think the reason is because koji depends on RPM Python binding.
And The rpm does not exist in PyPI.

$ grep -r 'import rpm' koji
koji/__init__.py:import rpm

However I developed the python package to solve this situation.
https://github.com/junaruga/rpm-py-installer

So, it is possible to upload koji to PyPI now technically.
Please keep opening this ticket.
I would ask to Koji project.

Nice, @jaruga.

See this thread on the koji devel list. Maybe you can move it forwards?

For now, I think you'll need to create your virtualenv with --system-site-packages enabled to pull in rpm and friends.

@ralph Thanks for the info.

Now mbs-build works on virtualenv by your suggested way.
OK, I will take a look at the URL about kojis setup.py.

$ sudo dnf install python2-koji
$ virtualenv --python=python --system-site-packages ./venv2
$ source venv2/bin/active
(venv2) $ which mbs-build
/home/jaruga/git/fedora-modularity/fm-orchestrator/venv2/bin/mbs-build
(venv2) $ mbs-build --help | head -1
usage: mbs-build [-h] [-d] [-v] [-q] [-k] [-s SERVER] [-i IDPROVIDER]

I commended on the koji-devel list page, though it is not appeared in the page yet.

I sent email to the reporter in the thread directly.
https://github.com/pbabinca

I tried to post from the page, send email to koji-devel ML several times.
But I could not. I do not why.

Actual discussion for koji installing from PyPI here.
https://pagure.io/koji/issue/458

This seems to be resolved. Will close this now.

Metadata Update from @mprahl:
- Issue status updated to: Closed (was: Open)

@mprahl are you sure?

Still error on Python 3.6.2.

(venv) $ pwd
/home/jaruga/git/fm-orchestrator
(venv) $ python --version
Python 3.6.2
(venv) $ pip install -e .
Obtaining file:///home/jaruga/git/fm-orchestrator
Collecting Flask (from module-build-service==1.5.0)
  Using cached Flask-0.12.2-py2.py3-none-any.whl
Collecting Flask-Migrate (from module-build-service==1.5.0)
  Using cached Flask_Migrate-2.1.1-py2.py3-none-any.whl
Collecting Flask-SQLAlchemy (from module-build-service==1.5.0)
  Using cached Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl
Collecting Flask-Script (from module-build-service==1.5.0)
  Using cached Flask-Script-2.0.6.tar.gz
Collecting dogpile.cache (from module-build-service==1.5.0)
Collecting fedmsg (from module-build-service==1.5.0)
  Using cached fedmsg-1.0.1-py2.py3-none-any.whl
Collecting funcsigs (from module-build-service==1.5.0)
  Using cached funcsigs-1.0.2-py2.py3-none-any.whl
Collecting futures (from module-build-service==1.5.0)
  Using cached futures-3.1.1.tar.gz
Collecting httplib2 (from module-build-service==1.5.0)
  Using cached httplib2-0.10.3.tar.gz
Collecting kerberos (from module-build-service==1.5.0)
  Using cached kerberos-1.2.5.tar.gz
Collecting kobo>=0.5.0 (from module-build-service==1.5.0)
  Using cached kobo-0.7.0.tar.bz2
Collecting ldap3 (from module-build-service==1.5.0)
  Using cached ldap3-2.4-py2.py3-none-any.whl
Collecting m2crypto (from module-build-service==1.5.0)
  Using cached M2Crypto-0.27.0.tar.gz
    Complete output from command python setup.py egg_info:
    running egg_info
    creating pip-egg-info/M2Crypto.egg-info
    writing pip-egg-info/M2Crypto.egg-info/PKG-INFO
    writing dependency_links to pip-egg-info/M2Crypto.egg-info/dependency_links.txt
    writing requirements to pip-egg-info/M2Crypto.egg-info/requires.txt
    writing top-level names to pip-egg-info/M2Crypto.egg-info/top_level.txt
    writing manifest file 'pip-egg-info/M2Crypto.egg-info/SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-zi4r5g7h/m2crypto/setup.py", line 350, in <module>
        'clean': Clean
      File "/usr/local/python-3.6.2/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/python-3.6.2/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/local/python-3.6.2/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/jaruga/git/fm-orchestrator/venv/lib/python3.6/site-packages/setuptools/command/egg_info.py", line 279, in run
        self.find_sources()
      File "/home/jaruga/git/fm-orchestrator/venv/lib/python3.6/site-packages/setuptools/command/egg_info.py", line 306, in find_sources
        mm.run()
      File "/home/jaruga/git/fm-orchestrator/venv/lib/python3.6/site-packages/setuptools/command/egg_info.py", line 533, in run
        self.add_defaults()
      File "/home/jaruga/git/fm-orchestrator/venv/lib/python3.6/site-packages/setuptools/command/egg_info.py", line 562, in add_defaults
        sdist.add_defaults(self)
      File "/home/jaruga/git/fm-orchestrator/venv/lib/python3.6/site-packages/setuptools/command/py36compat.py", line 36, in add_defaults
        self._add_defaults_ext()
      File "/home/jaruga/git/fm-orchestrator/venv/lib/python3.6/site-packages/setuptools/command/py36compat.py", line 119, in _add_defaults_ext
        build_ext = self.get_finalized_command('build_ext')
      File "/usr/local/python-3.6.2/lib/python3.6/distutils/cmd.py", line 299, in get_finalized_command
        cmd_obj.ensure_finalized()
      File "/usr/local/python-3.6.2/lib/python3.6/distutils/cmd.py", line 107, in ensure_finalized
        self.finalize_options()
      File "/tmp/pip-build-zi4r5g7h/m2crypto/setup.py", line 161, in finalize_options
        self.include_dirs += _get_additional_includes()
      File "/tmp/pip-build-zi4r5g7h/m2crypto/setup.py", line 51, in _get_additional_includes
        err = [line.lstrip() for line in err.split('\n') if line and line[0] == ' ']
    TypeError: a bytes-like object is required, not 'str'
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-zi4r5g7h/m2crypto/

@jaruga MBS isn't Python 3 compatible due to its dependencies, so there's not much we can do about that for now.

@mprahl ok I was succeeded to install on Python 2.7.

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/mbs/issues/700

Please continue any further discussion there.

Metadata