florath / rmtoo

Free and Open Source Requirements Management TooL
http://rmtoo.florath.net
Other
207 stars 59 forks source link

module 'distutils' has no attribute 'sysconfig' #11

Closed iantron closed 6 years ago

iantron commented 7 years ago

I'm getting the error below when running from a docker container. It seems that importing distutils.sysconfig instead of just distutils solves the problem, but I'm not exactly sure why or what the implications of the change are.

repo docker hub repository

I haven't finished dockerizing or put a public face on the repos yet, so it's not particularly user friendly. I'm hoping to get the application up and 'make'ing first.

Makefile:32: .rmtoo_dependencies: No such file or directory rmtoo -j file://Config.json \ --create-makefile-dependencies=.rmtoo_dependencies Traceback (most recent call last): File "/usr/local/bin/rmtoo", line 11, in <module> sys.exit(main()) File "/usr/local/lib/python3.5/dist-packages/rmtoo/lib/RmtooMain.py", line 89, in main main_impl(sys.argv[1:], sys.stdout, sys.stderr) File "/usr/local/lib/python3.5/dist-packages/rmtoo/lib/RmtooMain.py", line 81, in main_impl exitfun(not mainfunc(args, mstdout, mstderr)) File "/usr/local/lib/python3.5/dist-packages/rmtoo/lib/RmtooMain.py", line 72, in main_func config, input_mods = MainHelper.main_setup(args, mstdout, mstderr) File "/usr/local/lib/python3.5/dist-packages/rmtoo/lib/main/MainHelper.py", line 37, in main_setup config = MainHelper.main_setup_config(args) File "/usr/local/lib/python3.5/dist-packages/rmtoo/lib/main/MainHelper.py", line 30, in main_setup_config config.merge_cmd_line_params(args) File "/usr/local/lib/python3.5/dist-packages/rmtoo/lib/configuration/Cfg.py", line 170, in merge_cmd_line_params ldicts = CmdLineParams.create_dicts(args) File "/usr/local/lib/python3.5/dist-packages/rmtoo/lib/configuration/CmdLineParams.py", line 124, in create_dicts lresult.append(CmdLineParams.add_deprecated_values(args)) File "/usr/local/lib/python3.5/dist-packages/rmtoo/lib/configuration/CmdLineParams.py", line 63, in add_deprecated_values mod_dir = distutils.sysconfig.get_python_lib() AttributeError: module 'distutils' has no attribute 'sysconfig' Makefile:38: recipe for target '.rmtoo_dependencies' failed make: *** [.rmtoo_dependencies] Error 1

florath commented 7 years ago

Thanks for reporting this.

I'm not really sure what you want to do - missing all your scripts...

Nevertheless, if you need a docker image (instead of a VM), please consider using

https://github.com/florath/rmtoo/blob/master/contrib/vmsetup/create_vm_images.sh

and comment out the last line. This creates a complete and ready to use docker image - which is about 30% smaller than yours.

If you need further help, please provide the scripts creating the docker image especially how you install the python virtual environment for rmtoo.

ppoektos commented 7 years ago

I have similar error while running in KVM:

$ make
Makefile:32: .rmtoo_dependencies: No such file or directory
rmtoo -j file://Config.json \
        --create-makefile-dependencies=.rmtoo_dependencies
Traceback (most recent call last):
  File "/usr/local/bin/rmtoo", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/rmtoo/lib/RmtooMain.py", line 89, in main
    main_impl(sys.argv[1:], sys.stdout, sys.stderr)
  File "/usr/local/lib/python2.7/dist-packages/rmtoo/lib/RmtooMain.py", line 81, in main_impl
    exitfun(not mainfunc(args, mstdout, mstderr))
  File "/usr/local/lib/python2.7/dist-packages/rmtoo/lib/RmtooMain.py", line 72, in main_func
    config, input_mods = MainHelper.main_setup(args, mstdout, mstderr)
  File "/usr/local/lib/python2.7/dist-packages/rmtoo/lib/main/MainHelper.py", line 37, in main_setup
    config = MainHelper.main_setup_config(args)
  File "/usr/local/lib/python2.7/dist-packages/rmtoo/lib/main/MainHelper.py", line 30, in main_setup_config
    config.merge_cmd_line_params(args)
  File "/usr/local/lib/python2.7/dist-packages/rmtoo/lib/configuration/Cfg.py", line 170, in merge_cmd_line_params
    ldicts = CmdLineParams.create_dicts(args)
  File "/usr/local/lib/python2.7/dist-packages/rmtoo/lib/configuration/CmdLineParams.py", line 124, in create_dicts
    lresult.append(CmdLineParams.add_deprecated_values(args))
  File "/usr/local/lib/python2.7/dist-packages/rmtoo/lib/configuration/CmdLineParams.py", line 63, in add_deprecated_values
    mod_dir = distutils.sysconfig.get_python_lib()
AttributeError: 'module' object has no attribute 'sysconfig'
Makefile:38: recipe for target '.rmtoo_dependencies' failed
make: *** [.rmtoo_dependencies] Error 1
florath commented 7 years ago

Thanks for reporting this.

It looks that there is really a problem here - but I currently not able to reproduce it. (Even travis running python 2.7, 3.4, 3.5 and 3.6 is happy...)

Can you please give a detailed description about the environment you are using (distribution, version, used python, used commands) that I'm able to reproduce this? Can you give me some hints how the VM was created? (Did you use the provided scripts?)

florath commented 7 years ago

Because I received the same bug report three times now, I decided to change the import. Travis builds are (still) fine. Can you please check with the latest version?

ppoektos commented 7 years ago
Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-78-generic x86_64)
Linux netcore 4.4.0-78-generic #99-Ubuntu SMP Thu Apr 27 15:29:09 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ sudo apt install python-pip
$ python -V
Python 2.7.12
$ pip install --upgrade pip setuptools wheel
$ sudo pip install --only-binary=numpy,scipy numpy scipy
$ sudo pip install rmtoo
$ sudo cp -r /usr/local/rmtoo/contrib/template_project/ ./TestProject
$ cd TestProject/
$ . ./setenv.sh DEB
$ make
Makefile:32: .rmtoo_dependencies: No such file or directory

How can I get latest version? pip install --upgrade rmtoo?

florath commented 7 years ago

The patch was currently not bundled into a release.

You need either:

  1. Use the latest sources directly from github (git clone ...)
  2. Adapt your local sources. Search for CmdLineParams.py in your local virtualenv and change line 14 as described here: https://github.com/florath/rmtoo/commit/e039269596aa6c55eb6b872c5da6a97d2d605c89
  3. Wait a couple of days until the next version (which includes the patch) is released.
elarivie commented 6 years ago

@florath

I had the same issue (Ubuntu 16.04.3 LTS) (rmtoo-24.3.0)

AttributeError: 'module' object has no attribute 'sysconfig'

I confirm that the issue is fix with the changes in the following commit e039269

I manually replaced the content of the file:

With the content of https://github.com/florath/rmtoo/blob/e039269596aa6c55eb6b872c5da6a97d2d605c89/rmtoo/lib/configuration/CmdLineParams.py

And it fixes the issue

import distutils 🢀 This cause the issue
import distutils.sysconfig 🢀 This works fine
jginsburgn commented 6 years ago

I prepared a docker image with rmtoo working fine. Do: curl -o- -# http://example.com/some/url/rmtoo.tar.gz | docker image load

florath commented 6 years ago

I'm not really sure about your comment: why are you posting this here?

Please note that

  1. there is a security issue using docker images from unknown sources - and especially if the scripts how the image was build is not published.
  2. there is currently a VM available for evaluation and small projects (see https://github.com/florath/rmtoo/blob/master/contrib/vmsetup/Readme.rst)
  3. there is already a script for creating a docker image.

Esp. because of the first point, I'll deface the link that you posted.

If you want to add / change the scripts for building docker images, please fork the project and create a pull request.

dav1d-wright commented 5 years ago

@florath Hi, I just found out about rmtoo, and I think it looks very promising! First of all thanks for putting up the effort!

I've had some initial trouble setting it up, however, thanks to other users having had the same trouble it looks like I managed to resolve the issues.

Has this fix been added to a release already? The latest seems to be 24.3.0, and I had to manually copy the latest version of this file into the folder for this to be resolved.