Giter VIP home page Giter VIP logo

Comments (18)

Trolexum avatar Trolexum commented on May 18, 2024 4

@LLh-lihan, @Lotus-Lian: What is the name of your python file? If it is 'pyod.py', rename it. In this case you are importing your own script.

from pyod.

chanduthedev avatar chanduthedev commented on May 18, 2024 2

Make sure that python file name is not pyod.py. if package name and file name are same, will face this kind of error.

from pyod.

yzhao062 avatar yzhao062 commented on May 18, 2024 1

The issue you saw is specific to the virtual env Qt problem on mac, which is caused by matplotlib, and it is a lingering issue. The problem can be reproduced by:
import matplotlib.pyplot as plt
It throws error if you install the matplotlib with pip command in a mac conda virtual env... There are several fixes though.

Using workaround 1, I managed to install pyod in mac virtual env and also succeeded in running examples. See the screenshot below:

snip20180612_1

To facilitate the installation, I also removed the use of matplotlib in the code (I do not remove it from dependency since example codes still need it) and publish a new version 0.5.2. You may want to give it a shot...

Let me know if the problem persists.

from pyod.

mdlockyer avatar mdlockyer commented on May 18, 2024

Also have the same issue when installing from source

from pyod.

mdlockyer avatar mdlockyer commented on May 18, 2024

Should also note that I'm attempting to install into an Anaconda environment running Python 3.6.5

from pyod.

yzhao062 avatar yzhao062 commented on May 18, 2024

Thanks for the feedback. I included the test files in the package which triggers "nose", even it is only listed as optional. I will submit a fix (possibly tonight) to remove test files in the package. Will comment again once that is ready. Yue

from pyod.

mdlockyer avatar mdlockyer commented on May 18, 2024

Sounds good!

from pyod.

yzhao062 avatar yzhao062 commented on May 18, 2024

Sorry I just noticed that another problem is pyod depends on sklearn...which uses nose for validation, see error message below.
If possible, I would suggest installing nose (by either pip install nose or use Requirments.txt). I will need to double check sklearn dependency, which may not be possible to fix from my end. If that is the case, I will have change 'nose' from optional to required...

    from sklearn.utils.testing import assert_equal
  File "/Users/michael/anaconda3/envs/PyVi/lib/python3.6/site-packages/sklearn/utils/testing.py", line 49, in <module>
    from nose.tools import raises

from pyod.

mdlockyer avatar mdlockyer commented on May 18, 2024

Tried installing nose then installing Pyod. I get an issue here that comes from matplotlib. It's an Anaconda (or venv I assume) specific error because matplotlib wants python installed as a framework. It seems like at the moment Pyod won't work in an Anaconda env. Possibly something for a future version as I would assume a lot of people working with data science/ statistics would use Anaconda.

here is the backtrace for reference:

(PyVi) Michael:PyVi michael$ pip install pyod
Collecting pyod
  Using cached https://files.pythonhosted.org/packages/c9/8c/6774fa2e7ae6fe9c2c648114d15ba584f950002377480e14183a0999af30/pyod-0.5.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/j4/_68f6f3j4d51_2smq2mh5hyh0000gn/T/pip-install-7z8033c1/pyod/setup.py", line 2, in <module>
        from pyod import __version__
      File "/private/var/folders/j4/_68f6f3j4d51_2smq2mh5hyh0000gn/T/pip-install-7z8033c1/pyod/pyod/__init__.py", line 4, in <module>
        from . import models
      File "/private/var/folders/j4/_68f6f3j4d51_2smq2mh5hyh0000gn/T/pip-install-7z8033c1/pyod/pyod/models/__init__.py", line 2, in <module>
        from .abod import ABOD
      File "/private/var/folders/j4/_68f6f3j4d51_2smq2mh5hyh0000gn/T/pip-install-7z8033c1/pyod/pyod/models/abod.py", line 17, in <module>
        from .base import BaseDetector
      File "/private/var/folders/j4/_68f6f3j4d51_2smq2mh5hyh0000gn/T/pip-install-7z8033c1/pyod/pyod/models/base.py", line 27, in <module>
        from ..utils.utility import precision_n_scores
      File "/private/var/folders/j4/_68f6f3j4d51_2smq2mh5hyh0000gn/T/pip-install-7z8033c1/pyod/pyod/utils/__init__.py", line 9, in <module>
        from .data import generate_data
      File "/private/var/folders/j4/_68f6f3j4d51_2smq2mh5hyh0000gn/T/pip-install-7z8033c1/pyod/pyod/utils/data.py", line 16, in <module>
        import matplotlib.pyplot as plt
      File "/Users/michael/anaconda3/envs/PyVi/lib/python3.6/site-packages/matplotlib/pyplot.py", line 115, in <module>
        _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
      File "/Users/michael/anaconda3/envs/PyVi/lib/python3.6/site-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
        [backend_name], 0)
      File "/Users/michael/anaconda3/envs/PyVi/lib/python3.6/site-packages/matplotlib/backends/backend_macosx.py", line 17, in <module>
        from matplotlib.backends import _macosx
    RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/j4/_68f6f3j4d51_2smq2mh5hyh0000gn/T/pip-install-7z8033c1/pyod/

from pyod.

tomron avatar tomron commented on May 18, 2024

I think that similar solution to this can solve the first issue - sciunto-org/python-bibtexparser#111 (I can create a PR with this solution if you would like)

from pyod.

yzhao062 avatar yzhao062 commented on May 18, 2024

@tomron Thanks Tom. I did check the post and it is an interesting bug :)
The pip install issue in pyod is because I used a function "sklearn.utils.testing.assert_equal", which depends on nose.tools. Even I listed sklearn in requirements.txt, it still requires nose to be installed, which should have been installed because sklearn depends on nose. This bug would happen if a person installs sklearn first and then uninstalls nose. The requirement of sklearn is fulfilled but nose is not there.

So I fixed this bug by listing nose as one of the requirements in requirements.txt. Not sure if this is exactly the same bug you mentioned.

from pyod.

tomron avatar tomron commented on May 18, 2024

This issue is actually a mixture of several issues which should probably be separated to several issues.

As a user of your package I don't want to pre install myself any dependency I want the setup file to do that.
When you import pyod in the setup file it calls the init file which imports other files and if the required packages are not present it will fail. The fix I suggested will fix this issue (I also suggest to fix the dependencies' versions, some dependencies miss the version)

from pyod.

yzhao062 avatar yzhao062 commented on May 18, 2024

#12 should fix the setup.py dependency issue. #

from pyod.

Hasakii-ghj avatar Hasakii-ghj commented on May 18, 2024

I received an error when i exported the pyod.models.hbos however i have successfully installed pyod in ananconda environment ,the error shows like 'No module named 'pyod.models'; 'pyod' is not a package'

from pyod.

yzhao062 avatar yzhao062 commented on May 18, 2024

@dksajgfaigfkja It should be working. I just tested it under Python 2.7 and Python 3.7 by initializing new env with conda. The command I used is:

conda create -n newenv python=2.7
conda activate newenv
pip install pyod
pip list <- make sure pyod is installed
image
python hbos_example.py

Thoughts:

  • make sure env is correct
  • use pip list to see whether pyod is installed
  • reactivate the env if needed

from pyod.

Lotus-Lian avatar Lotus-Lian commented on May 18, 2024

@Hasakii-ghj I have the same problems. Did you solve this problem? Would you mind giving me some suggestions about this? Thank you so much.

from pyod.

yzhao062 avatar yzhao062 commented on May 18, 2024

@Lotus-Lian maybe try conda install? https://anaconda.org/conda-forge/pyod

from pyod.

LLh-lihan avatar LLh-lihan commented on May 18, 2024

@yzhao062 Thank you for your suggestion. But I used conda install. But it doesn't work.

from pyod.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.