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

Fix circular dependency in setup.py #12

Merged
merged 2 commits into from
Jul 25, 2018
Merged

Fix circular dependency in setup.py #12

merged 2 commits into from
Jul 25, 2018

Conversation

ucabvas
Copy link
Contributor

@ucabvas ucabvas commented Jul 9, 2018

Installing this package in a new virtualenv fails because setup.py tries to import pyod which in turn tries to import all its dependencies (numpy is in the error message in particular). However, it's setup.py's responsibility to install numpy and it gets imported before it's installed.

Fixing this by decoupling the version string from the pyod init file. For reference, this is the error we were seeing prior to the fix:

(env_pyod) ☁  ~VIRTUAL_ENV  pip install pyod
Collecting pyod
  Downloading https://files.pythonhosted.org/packages/08/bf/05bef83df97f81a6492818e0a42034e1bcc222894fd66bd4ce66c23a8654/pyod-0.5.4.tar.gz (44kB)
    100% |████████████████████████████████| 51kB 2.3MB/s
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/v3/d3h954156117rd5xdlfh8c0d081dvn/T/pip-install-G3JNoB/pyod/setup.py", line 2, in <module>
        from pyod import __version__
      File "pyod/__init__.py", line 4, in <module>
        from . import models
      File "pyod/models/__init__.py", line 2, in <module>
        from .abod import ABOD
      File "pyod/models/abod.py", line 12, in <module>
        import numpy as np
    ImportError: No module named numpy

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/v3/d3h954156117rd5xdlfh8c0d081dvn/T/pip-install-G3JNoB/pyod/

@coveralls
Copy link

coveralls commented Jul 9, 2018

Pull Request Test Coverage Report for Build 156

  • 1 of 2 (50.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 96.076%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pyod/version.py 0 1 0.0%
Totals Coverage Status
Change from base Build 154: -0.04%
Covered Lines: 2326
Relevant Lines: 2421

💛 - Coveralls

@yzhao062
Copy link
Owner

@ucabvas Thanks for submitting a fix. I am just back from vacation and would take a look tomorrow.

Just wonder whether the fix is fine with all platforms (win/mac/unix)? especially with './pyod/version.py'. What about using os.path.join(os.path.sep, 'pyod', 'version.py') instead?

@yzhao062 yzhao062 merged commit 1014191 into yzhao062:master Jul 25, 2018
@yzhao062
Copy link
Owner

@ucabvas Fantastic! The PR is merged and a new version is pushed to pypi(v0.5.6) :)
Removed one unnecessary delimiter to please the doc builder.

Thanks a lot for spotting this bug!

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

Successfully merging this pull request may close these issues.

3 participants