CybOXProject / python-cybox

A Python library for parsing, manipulating, and generating CybOX content.

Home Page:http://cybox.readthedocs.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Python installation issues with python 3.6

jpleger opened this issue · comments

Looks like cybox is bringing in importlib as an external dependency, which is a python builtin past 2.6 and 3.0. This appears to be breaking the installation on 3.6. The author has also stopped supporting that wrapper, so a fix is unlikely.

Might be time to deprecate support of python 2.6, since the last officially supported version of 2.6 was in 2013. Might make sense to add a note in the docs that if you are using 2.6 or 3.0 install the libimport module.

Using a clean virtual env in 3.6 has error with dependency installation:

james.pleger@JPWORK:~$ mkvirtualenv --no-site-packages -p python3.6 cybox-testing
Running virtualenv with interpreter /usr/local/bin/python3.6
Using base prefix '/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6'
New python executable in /Users/james.pleger/.virtualenvs/cybox-testing/bin/python3.6
Also creating executable in /Users/james.pleger/.virtualenvs/cybox-testing/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/get_env_details
(cybox-testing) james.pleger@JPWORK:~$ pip install cybox --no-cache-dir
Collecting cybox
  Downloading cybox-2.1.0.15-py2.py3-none-any.whl (732kB)
    100% |████████████████████████████████| 737kB 12.6MB/s 
Collecting python-dateutil (from cybox)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 20.7MB/s 
Collecting mixbox>=1.0.2 (from cybox)
  Downloading mixbox-1.0.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 48.4MB/s 
Collecting importlib (from cybox)
  Downloading importlib-1.0.4.zip
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/Users/james.pleger/.virtualenvs/cybox-testing/lib/python3.6/site-packages/setuptools/__init__.py", line 5, in <module>
        import distutils.core
      File "/Users/james.pleger/.virtualenvs/cybox-testing/lib/python3.6/distutils/__init__.py", line 4, in <module>
        import imp
      File "/Users/james.pleger/.virtualenvs/cybox-testing/lib/python3.6/imp.py", line 19, in <module>
        from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name
    ModuleNotFoundError: No module named 'importlib._bootstrap'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/t6/36n7164j599bffhbst9yfqr02r06jq/T/pip-build-8d6nhdgb/importlib/
(cybox-testing) james.pleger@JPWORK:~$ python --version; pip --version
Python 3.6.3
pip 9.0.1 from /Users/james.pleger/.virtualenvs/cybox-testing/lib/python3.6/site-packages (python 3.6)
(cybox-testing) james.pleger@JPWORK:~$ 

In python 2.7, works fine, but installs the external same lib externally, which I don't believe you guys were wanting to do in your setup.py.

james.pleger@JPWORK:~$ mkvirtualenv --no-site-packages -p python2.7 cybox-testing
Running virtualenv with interpreter /usr/local/bin/python2.7
New python executable in /Users/james.pleger/.virtualenvs/cybox-testing/bin/python2.7
Also creating executable in /Users/james.pleger/.virtualenvs/cybox-testing/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/james.pleger/.virtualenvs/cybox-testing/bin/get_env_details
(cybox-testing) james.pleger@JPWORK:~$ pip install 
(cybox-testing) james.pleger@JPWORK:~$ pip install cybox --no-cache-dir
Collecting cybox
  Downloading cybox-2.1.0.15-py2.py3-none-any.whl (732kB)
    100% |████████████████████████████████| 737kB 11.0MB/s 
Collecting lxml>=2.2.3 (from cybox)
  Downloading lxml-4.1.1-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (8.7MB)
    100% |████████████████████████████████| 8.7MB 8.2MB/s 
Collecting python-dateutil (from cybox)
  Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
    100% |████████████████████████████████| 194kB 8.0MB/s 
Collecting mixbox>=1.0.2 (from cybox)
  Downloading mixbox-1.0.2-py2.py3-none-any.whl (46kB)
    100% |████████████████████████████████| 51kB 19.6MB/s 
Collecting importlib (from cybox)
  Downloading importlib-1.0.4.zip
Collecting six>=1.5 (from python-dateutil->cybox)
  Downloading six-1.11.0-py2.py3-none-any.whl
Collecting ordered-set (from mixbox>=1.0.2->cybox)
  Downloading ordered-set-2.0.2.tar.gz
Collecting weakrefmethod>=1.0.3; python_version < "3.4" (from mixbox>=1.0.2->cybox)
  Downloading weakrefmethod-1.0.3.tar.gz
Installing collected packages: lxml, six, python-dateutil, ordered-set, weakrefmethod, mixbox, importlib, cybox
  Running setup.py install for ordered-set ... done
  Running setup.py install for weakrefmethod ... done
  Running setup.py install for importlib ... done
Successfully installed cybox-2.1.0.15 importlib-1.0.4 lxml-4.1.1 mixbox-1.0.2 ordered-set-2.0.2 python-dateutil-2.6.1 six-1.11.0 weakrefmethod-1.0.3
(cybox-testing) james.pleger@JPWORK:~$ 

Dependency is defined in the python wheel package under dist-info:

james.pleger@JPWORK:/tmp/cybox-2.1.0.15.dist-info$ grep Requires-Dist METADATA 
Requires-Dist: importlib
Requires-Dist: lxml (>=2.2.3)
Requires-Dist: mixbox (>=1.0.2)
Requires-Dist: python-dateutil

Hi @jpleger!
Thanks for your submission! Can you confirm you have a recent version of setuptools? (20.8 or later)

Looks like the error is caused by me using an out-of-date version of setuptools and/or wheel to build the wheel on PyPI, so the ; python_version == "2.6" specifier on the importlib dependency got dropped.

I'll release a new 2.1.0.16 shortly that will fix that.

2.1.0.16 was pushed to PyPI.

Appreciate the quick response, just confirmed that 2.1.0.16 fixes this issue.

Thanks for reporting this, @jpleger !