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

ImportError: No module named pathlib #33

Closed
fungi opened this issue Apr 23, 2015 · 8 comments
Closed

ImportError: No module named pathlib #33

fungi opened this issue Apr 23, 2015 · 8 comments

Comments

@fungi
Copy link

fungi commented Apr 23, 2015

New in 2.0.0: import Py3K stdlib module pathlib even on Python 2.x where it does not exist

Traceback (most recent call last):
  File "/opt/stack/new/horizon/manage.py", line 23, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
    django.setup()
  File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 87, in create
    module = import_module(entry)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/local/lib/python2.7/dist-packages/django_pyscss/__init__.py", line 1, in <module>
    from .compiler import DjangoScssCompiler  # NOQA
  File "/usr/local/lib/python2.7/dist-packages/django_pyscss/compiler.py", line 4, in <module>
    from pathlib import PurePath
ImportError: No module named pathlib
@cboylan
Copy link

cboylan commented Apr 23, 2015

Note pathlib is not in stdlib for python < 3.4. You can install it from pypi but django-pyscss does not list pathlib as a dependency in its setup.py so it does not get installed on older python.

fungi added a commit to openstack/requirements that referenced this issue Apr 23, 2015
django-pyscss 2.0.0 attempts to import Py3K stdlib module pathlib
even on Python 2.x where it does not exist.

File "/usr/local/lib/python2.7/dist-packages/django_pyscss/compiler.py",
        line 4, in <module>
    from pathlib import PurePath
ImportError: No module named pathlib

fusionbox/django-pyscss#33

Change-Id: I5df5baca3c5b79bfb173c4197421a7312da6ccd8
fungi added a commit to openstack/openstack that referenced this issue Apr 23, 2015
Project: openstack/requirements  8c0ff9178c367c5749100fdf00e3a61815c81baa

Skip django-pyscss 2.0.0

django-pyscss 2.0.0 attempts to import Py3K stdlib module pathlib
even on Python 2.x where it does not exist.

File "/usr/local/lib/python2.7/dist-packages/django_pyscss/compiler.py",
        line 4, in <module>
    from pathlib import PurePath
ImportError: No module named pathlib

fusionbox/django-pyscss#33

Change-Id: I5df5baca3c5b79bfb173c4197421a7312da6ccd8
fungi added a commit to openstack/openstack that referenced this issue Apr 23, 2015
Project: openstack/requirements  8c0ff9178c367c5749100fdf00e3a61815c81baa

Skip django-pyscss 2.0.0

django-pyscss 2.0.0 attempts to import Py3K stdlib module pathlib
even on Python 2.x where it does not exist.

File "/usr/local/lib/python2.7/dist-packages/django_pyscss/compiler.py",
        line 4, in <module>
    from pathlib import PurePath
ImportError: No module named pathlib

fusionbox/django-pyscss#33

Change-Id: I5df5baca3c5b79bfb173c4197421a7312da6ccd8
fungi added a commit to openstack/requirements that referenced this issue Apr 23, 2015
django-pyscss 2.0.0 attempts to import Py3K stdlib module pathlib
even on Python 2.x where it does not exist.

File "/usr/local/lib/python2.7/dist-packages/django_pyscss/compiler.py",
        line 4, in <module>
    from pathlib import PurePath
ImportError: No module named pathlib

fusionbox/django-pyscss#33

Change-Id: I5df5baca3c5b79bfb173c4197421a7312da6ccd8
(cherry picked from commit 8c0ff91)
@gavinwahl
Copy link
Member

Thanks for the report guys. Patch incoming.

@rockymeza
Copy link

Hi,

Thanks for bringing this up. Can I ask what version of pyScss you are
using? I'm liking at their choice and it seems to depend on pathlib for
Python < 3.4. We're running the tests on Python 3.3 and 3.4 and it seems to
be working.

Thanks again!
-Rocky Meza
2015年4月22日 下午6:10于 "Clark Boylan" notifications@github.com写道:

Note pathlib is not in stdlib for python < 3.4. You can install it from
pypi but django-pyscss does not list pathlib as a dependency in its
setup.py so it does not get installed on older python.


Reply to this email directly or view it on GitHub
#33 (comment)
.

@gavinwahl
Copy link
Member

That is pretty strange since pyScss 1.3 has pathlib as a dependency. How did you install django-pyscss?

django-pyscss should probably have it as a dependency no matter what since it does import it.

@gavinwahl
Copy link
Member

I think I see what's going on. You guys are requiring pyScss<1.3: https://github.com/openstack/requirements/blob/8c0ff9178c367c5749100fdf00e3a61815c81baa/global-requirements.txt#L48. django-pyscss 2.0 requires pyScss>=1.3. (See the changelog for 2.0.0: https://pypi.python.org/pypi/django-pyscss/2.0.0#id1). You should stay on the 1.x series of django-pyscss if you really need pyScss 1.2, or allow pyScss 1.3 in your requirements.

I can explicitly require pathlib and release 2.0.1 if it will help at all, but you're still going to have to change your pin. I'm going to close this since pathlib does get installed with the right version of pyScss, but feel free to comment if you want 2.0.1.

@greghaynes
Copy link

Good find, I believe you are correct about our requirements mismatch.

From what I can tell the backtrace originates from django-pyscss calling into pathlib directly so I do think adding a dependency on pathlib is something that should happen in django-pyscss, reguardless.

Thanks!

@fungi
Copy link
Author

fungi commented Apr 23, 2015

Agreed. If django-pyscss imports a module then it should ideally have the package providing that module listed as a direct dependency, not simply rely on it being provided as a transitive dependency (this is an insurance policy against a future update to pyScss dropping its use of pathlib).

It's still odd that the versioned install_requires on pyScss>=1.3.4 didn't raise an error during installation.

Anyway, thanks for spotting the mismatch! I'll get our requirements adjusted to accomodate that.

fungi added a commit to openstack/requirements that referenced this issue Apr 23, 2015
As pointed out in
fusionbox/django-pyscss#33 django-pyscss
2.0.0 install_requires pyScss>=1.3.4 which we currently cap at an
incompatible pyScss<1.3 instead. Make it so we install an old enough
django-pyscss to work with pyScss 1.2.x.

Change-Id: I0cde6300ee2f590beebfa8c624c22f8eaed47172
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Apr 23, 2015
Project: openstack/requirements  462791d319ca4368eb0fc2dacefc2d6bd51a0de6

Cap django-pyscss <2.0.0

As pointed out in
fusionbox/django-pyscss#33 django-pyscss
2.0.0 install_requires pyScss>=1.3.4 which we currently cap at an
incompatible pyScss<1.3 instead. Make it so we install an old enough
django-pyscss to work with pyScss 1.2.x.

Change-Id: I0cde6300ee2f590beebfa8c624c22f8eaed47172
openstack-gerrit pushed a commit to openstack/openstack that referenced this issue Apr 23, 2015
Project: openstack/requirements  462791d319ca4368eb0fc2dacefc2d6bd51a0de6

Cap django-pyscss <2.0.0

As pointed out in
fusionbox/django-pyscss#33 django-pyscss
2.0.0 install_requires pyScss>=1.3.4 which we currently cap at an
incompatible pyScss<1.3 instead. Make it so we install an old enough
django-pyscss to work with pyScss 1.2.x.

Change-Id: I0cde6300ee2f590beebfa8c624c22f8eaed47172
fungi added a commit to openstack/requirements that referenced this issue Apr 23, 2015
As pointed out in
fusionbox/django-pyscss#33 django-pyscss
2.0.0 install_requires pyScss>=1.3.4 which we currently cap at an
incompatible pyScss<1.3 instead. Make it so we install an old enough
django-pyscss to work with pyScss 1.2.x.

Change-Id: I0cde6300ee2f590beebfa8c624c22f8eaed47172
(cherry picked from commit 7da0b68)
gavinwahl added a commit that referenced this issue Apr 23, 2015
@rockymeza
Copy link

Fixed in the 2.0.1 release! Thanks for bringing this up!

https://pypi.python.org/pypi/django-pyscss/2.0.1

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

5 participants