laszukdawid / PyEMD

Python implementation of Empirical Mode Decompoisition (EMD) method
https://pyemd.readthedocs.io/
Apache License 2.0
867 stars 224 forks source link

ImportError: cannot import name 'emd' #23

Closed nazmibojan closed 6 years ago

nazmibojan commented 6 years ago

Hi All,

Sorry for this newbie question. I have run 'python setup.py install' in CMD as Administrator. I got no error until the last process showed this: ..Using c:\program files\python36\lib\site-packages\certifi-2018.4.16-py3.6.egg Finished processing dependencies for EMD-signal==0.2.4

But after I run my code that use the PyEMD library, I got this error: Traceback (most recent call last): File "hs_analisis_text_pyemd.py", line 6, in <module> from PyEMD import emd ImportError: cannot import name 'emd'

I also tried from PyEMD import EMD and still got the same error. I didn't find PyEMD packages in my python site package: C:\Program Files\ Python36\Libs\site-packages.

How can I solve this? Thank you. I use Windows 7.

Regard, Nazmi Febrian

nazmibojan commented 6 years ago

I think the problem happened because I use Python 3.6. Is it right?

Sincerely, Nazmi

laszukdawid commented 6 years ago

Hey @nazmibojan, Python 3.6 is definitely not an issue here. Actually, it's the primary version for which I'm releasing.

I think that in your case it's just a typo :) Python is case sensitive so you have to write from PyEMD import EMD. Can you check that?

Otherwise my guesses are:

Hope this help!

nazmibojan commented 6 years ago

Halo @laszukdawid ,

I have tried from PyEMD import EMD but still got the same error. I executed my python script in cmd. But, I could run my python script without error if I move the python script into folder ../PyEMD/Example. I apologize because I am a newbie in Python. Thank you

Regards, Nazmi

laszukdawid commented 6 years ago

Nazmi, don't worry, we all start somewhere :-)

How about we set up a common ground. Could you create a virtual environment and install PyEMD there? I understand that you're using Windows. Open the command line (cmd.exe) and go to directory where you want to create temporary files. Then try this:

C:\> python -m venv emd-test
C:\> emd-test/Scripts/activate.bat
C:\> pip install EMD-signal
C:\> python
>>> from PyEMD import EMD
>>> emd = EMD()

This is a minimal version on how to install PyEMD. Currently (10 min ago) I've released pip version so it's the same as github. However, if you'd prefer to install PyEMD from github you can do the following:

C:\> python -m venv emd-test
C:\> emd-test/Scripts/activate.bat
C:\> git clone https://github.com/laszukdawid/PyEMD
C:\> python setup.py install
C:\> python
>>> from PyEMD import EMD
>>> emd = EMD()

It seems that you have already done so with the second version. Could you try whether it works this time? If not, could you please attache log?

nazmibojan commented 6 years ago

Hi,

Good suggestion step. I have followed your recommendations step and that works! I got this output:

(emd-test) C:\>python
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 17:00:18) [MSC v.1900 64 bit (AMD6
4)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyEMD import EMD
>>> emd = EMD()
>>>

I also can run my previous python script in 'emd-test' folder that I make before. So should I run my python script in this folder everytime I need?

Regards, Nazmi

laszukdawid commented 6 years ago

Once you activate your virtual environment emd-test you can be wherever you want. Execution of the activate.bat sets up an environment which means that instead of using Python from the global directory (C:/Python36) you are going to use from wherever the emd-test lives. Your python have access to PyEMD. If you cloned the repo then you can try also:

C:\> <path_to_emd-test>/Scripts/activate.bat
C:\> cd <path_to_PyEMD_git_clone>/example
C:\> python simple_example.py
nazmibojan commented 6 years ago

Okay thank you @laszukdawid ! It's working now. Good luck.

Regards, Nazmi

umerAbbasi223 commented 5 years ago

i am following same procedure as you do but when i creating virtualenv after activate when i run command pip install EMD-signal it give me an error preparing wheel metadata .......error please help me out i am using ubuntu Mate 14.0 with python 3.5.2 Scipy 0.17.0 numpy 1.11.0

HoatranCH commented 2 years ago

Once you activate your virtual environment emd-test you can be wherever you want. Execution of the activate.bat sets up an environment which means that instead of using Python from the global directory (C:/Python36) you are going to use from wherever the emd-test lives. Your python have access to PyEMD. If you cloned the repo then you can try also:

C:\> <path_to_emd-test>/Scripts/activate.bat
C:\> cd <path_to_PyEMD_git_clone>/example
C:\> python simple_example.py

Hi image I follow your suggestion but when I import EMD from pyEMD, the error occurs as the figure. Could you please help me out ?. Thank you