“Cannot import name __version__” when installing c

2019-09-01 03:09发布

I've created a fresh venv running Python 3.3.2. While trying to install Campaign Monitor's createsend package via pip, it yields:

  Running setup.py egg_info for package createsend
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/vagrant/3.3.2venv/build/createsend/setup.py", line 5, in <module>
        from createsend import __version__
      File "./createsend/__init__.py", line 1, in <module>
        from createsend import __version__
    ImportError: cannot import name __version__
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/vagrant/3.3.2venv/build/createsend/setup.py", line 5, in <module>

    from createsend import __version__

  File "./createsend/__init__.py", line 1, in <module>

    from createsend import __version__

ImportError: cannot import name __version__

I believe this package is Python 3 compatible. I'm running the latest version of pip. Can anyone explain why I'm receiving this error?

1条回答
2楼-- · 2019-09-01 04:05

As of version 4.2.0, released 10 Oct, 2016, this package is now Python 3 compatible. Old answer, from 2013, follows below.


No, this package is not Python 3 compatible. It is using relative imports:

    from createsend import __version__
  File "./createsend/__init__.py", line 1, in <module>
    from createsend import __version__

where the second createsend is meant to be createsend/createsend.py. Instead, Python 3 sees it as an absolute package and the recursive import fails to find the __version__ name.

查看更多
登录 后发表回答