conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.25k stars 980 forks source link

[Windows] ImportError: No module named glob #631

Closed ForNeVeR closed 8 years ago

ForNeVeR commented 8 years ago

OS version: Windows 10 x64

I've installed conan 0.14.1 package from the official site, and trying to test it with this simple conanfile.txt:

[requires]
Qt/5.6.1-1@osechet/testing

[generators]
cmake

Here's the program output:

> conan install .
It seems to be the first time you run conan
Auto detecting your dev setup to initialize conan.conf
Found Visual Studio 11
Found Visual Studio 14
Default conan.conf settings
        os=Windows
        arch=x86_64
        compiler=Visual Studio
        compiler.version=14
        compiler.runtime=MD
        build_type=Release
*** You can change them in ~/.conan/conan.conf ***
*** Or override with -s compiler='other' -s ...s***

Qt/5.6.1-1@osechet/testing: Not found, looking in remotes...
WARN: Remotes registry file missing, creating default one in C:\Users\ForNeVeR\.conan\registry.txt
Qt/5.6.1-1@osechet/testing: Trying with 'conan.io'...
Downloading conanmanifest.txt
[==================================================]
Downloading conanfile.py
[==================================================]
Downloading conan_export.tgz
[==================================================]
icu/57.1@osechet/stable: Not found, looking in remotes...
icu/57.1@osechet/stable: Trying with 'conan.io'...
Downloading conanmanifest.txt
[==================================================]
Downloading conanfile.py
[==================================================]
Downloading conan_export.tgz
[==================================================]
ERROR: Unable to load conanfile in C:\Users\ForNeVeR\.conan\data\icu\57.1\osechet\stable\export\conanfile.py
    from glob import glob
ImportError: No module named glob

For some reason it cannot find the glob module. I believe that the script line in question is here.

What can be done with it? Is it package author mistake (and what should he do?) or a conan packaging issue (it have no necessary Python modules or something)?

memsharded commented 8 years ago

It seems an issue from the win conan installer. We suggest using the pip package, we have found to be the easiest and the one with less troubles. Having a python installation with pip is very easy in windows too. If you could try it, please tell us if it worked, we will have a look at the win installer when possible.

Thanks very much for your detailed report and feedback!

ForNeVeR commented 8 years ago

Okay, I'll try pip installation right now and report back here.

It would be nice though to determine an actual problem with the native installer. Eventually you'll need to either fix it or get rid of it (if that's actually an installer issue and not my environment).

memsharded commented 8 years ago

It should be an installer issue, because it bundles the python interpreter, and it doesn't (at least theoretically) depend on the environment. Yes, you are right, we will check it and report back too.

ForNeVeR commented 8 years ago

Yes, pip version works (it still cannot find the package variant for my environment, but it indeed reads / executes that package configuration without issues).

Thanks for help!

memsharded commented 8 years ago

I have also had good luck regenerating the win installer with "--hidden-import=glob". It will be included in the next release installers (will submit a PR later), but the underlying issue is that pyinstaller doesn't bundle the full python interpreter, so some other import might fail in the future. So I'd say that using the pip package is the best option. Thanks again for your feedback!

piponazo commented 7 years ago

Hi, we recently have a similar problem but in this case the problem is with the module distutils.dir_util:

ERROR: Unable to load conanfile in /home/pix4d/.conan/data/OpenSceneGraph/3.4.0-0/pix4d/stable/export/conanfile.py
    from distutils.dir_util import copy_tree
ImportError: No module named dir_util

While that package is present on my machine:

pix4d@pix4d-pc325 ~/src/pix4d/pix4d-mapper> python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from distutils.dir_util import copy_tree
>>>

As in the previous case, everything works when I use the pip version. However I think that it is worth it to investigate this issue, since it can be very annoying for people how just want to install conan with the installer and do not do it with pip.

memsharded commented 7 years ago

Yes, really annoying. But the thing is that we can do very little to avoid it. The only solution would be to force the inclusing of the whole Python standard library into the pyinstaller package, which IMO doesn't sound a good thing. And probably might have other issues as well.

Everyday I am more inclined to deprecate the Windows installer, I know that it is convenient, but lets face it, installing python in Win nowadays couldn't be simpler and faster. Plus there are other issues as well, as the command line expansion of patterns (try conan remove Pkg* with the win-installer, it might fail, and it is out of our scope to fix that).

If it is a big issue for you right now, we could just add distutils in the next Windows installer release.

Thanks for telling!

piponazo commented 7 years ago

No it is not a big issue. We have told all our developers to install conan using pip ;).

By the way, this problem is not happening only on Windows but also on Linux.

ForNeVeR commented 7 years ago

@memsharded, please note:

this problem is not happening only on Windows but also on Linux.

I think that case deserves additional investigation; looks like it's not related to Windows installer.

memsharded commented 7 years ago

Yes, that is totally true. The issue is related to the bundled app (conan + python interpreter) created with pyinstaller, which is the base for all the installers (Win, Linux, etc). That is why we have few control over it, it is how pyinstaller is doing things, and seems quite difficult to solve it from the outside.

The strongly recommended installation of conan is with the python/pip PyPI package. The download page already classify the Linux installer too as with possible issues.