alkaline-ml / pmdarima

A statistical library designed to fill the void in Python's time series analysis capabilities, including the equivalent of R's auto.arima function.
https://www.alkaline-ml.com/pmdarima
MIT License
1.58k stars 234 forks source link

Import error from pyramid.arima #23

Closed munitech4u closed 6 years ago

munitech4u commented 6 years ago

trying to impor auto_arima using below commands:

from pyramid.arima import auto_arima

error:

from pyramid.arima._arima import C_Approx

ImportError: cannot import name 'C_Approx'

Versions

run the following snippet and paste the output below. Windows-7-6.1.7601-SP1 Python 3.5.2 |Anaconda custom (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)] Pyramid 0.6.2 NumPy 1.12.1 SciPy 1.0.0 Scikit-Learn 0.20.dev0 Statsmodels 0.8.0

tgsmith61591 commented 6 years ago

If you file an issue, please fill out all the fields I requested. One of them is "versions." This has manifested itself in old numpy versions before. Please A) fill out the version info, and B) try updating your numpy installation.

munitech4u commented 6 years ago

Sorry, it was not showing for some reason

tgsmith61591 commented 6 years ago

Thanks. And what's your output of the following:

>>> import pyramid; print(pyramid.__file__)
//anaconda/lib/python2.7/site-packages/pyramid/__init__.pyc

(want to make sure the package is actually getting installed)

munitech4u commented 6 years ago
import pyramid; print(pyramid.__file__)
C:\Anaconda3\lib\site-packages\pyramid\__init__.py
tgsmith61591 commented 6 years ago

Hmm. I was hoping for output to indicate it hadn't installed properly. My guess is that your package built from src and not wheel. I don't suppose you still have the output from your pip install?

munitech4u commented 6 years ago

I uninstalled and reinstalled it. It installed from wheel

tgsmith61591 commented 6 years ago

Several others have had a similar problem but it was always a version issue (see #21, for instance). Try a new conda env. Let's get to the bottom of this...

$ conda create -n pmdissue23 --yes --quiet python=3.5 numpy scipy scikit-learn statsmodels

Once it's been created, source it. Since you're on Windows, that will be:

activate pmdissue23

If you were on a Unix machine (for others who may later visit this issue):

$ source activate pmdissue23

Now try to install pyramid:

(pmdissue23) $ pip install pyramid-arima

You could always use the -v flag to trace the Pip install. But eventually, you should get a block like this (some output cleaned up):

  Downloading pyramid_arima-0.6.2-cp35-cp35m-macosx_10_6_x86_64.whl (137kB)
  Downloading from URL https://pypi.python.org/packages/1c/10/0a92695ca46e7a2b8a2f0c415ba0433aad55c6a464e0180b7a6cc3c77635/pyramid_arima-0.6.2-cp35-cp35m-macosx_10_6_x86_64.whl#md5=37fd403a5a534f2e382c77b3c4f19438 (from https://pypi.python.org/simple/pyramid-arima/) (requires-python:>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4)
    97% |███████████████████████████████ | 133kB 3.0MB/s eta 0:00:01  Updating cache with response from "https://pypi.python.org/packages/1c/10/0a92695ca46e7a2b8a2f0c415ba0433aad55c6a464e0180b7a6cc3c77635/pyramid_arima-0.6.2-cp35-cp35m-macosx_10_6_x86_64.whl"
  Caching due to etag
    100% |████████████████████████████████| 143kB 4.1MB/s 
Requirement already satisfied: numpy>=1.9 in /anaconda/envs/pmdissue23/lib/python3.5/site-packages (from pyramid-arima)
Requirement already satisfied: scikit-learn>=0.17 in /anaconda/envs/pmdissue23/lib/python3.5/site-packages (from pyramid-arima)
Requirement already satisfied: statsmodels>=0.8 in /anaconda/envs/pmdissue23/lib/python3.5/site-packages (from pyramid-arima)
Collecting Cython>=0.23 (from pyramid-arima)
  Downloading Cython-0.28.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (5.1MB)
  Downloading from URL https://pypi.python.org/packages/ac/2b/5f42b08e5b06b21673ed2f226908bcebf35077079af3ebce0d08bfe907a5/Cython-0.28.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl#md5=6b7bb1f5bb1f79c277d04fa47ac153bb (from https://pypi.python.org/simple/cython/)
    99% |████████████████████████████████| 5.1MB 9.6MB/s eta 0:00:01  Updating cache with response from "https://pypi.python.org/packages/ac/2b/5f42b08e5b06b21673ed2f226908bcebf35077079af3ebce0d08bfe907a5/Cython-0.28.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl"
  Caching due to etag
    100% |████████████████████████████████| 5.1MB 321kB/s 
Requirement already satisfied: scipy>=0.9 in /anaconda/envs/pmdissue23/lib/python3.5/site-packages (from pyramid-arima)
Installing collected packages: Cython, pyramid-arima

  changing mode of //anaconda/envs/pmdissue23/bin/cython to 755
  changing mode of //anaconda/envs/pmdissue23/bin/cygdb to 755
  changing mode of //anaconda/envs/pmdissue23/bin/cythonize to 755

Successfully installed Cython-0.28.1 pyramid-arima-0.6.2
Cleaning up...

Determine whether it installed correctly:

from pyramid.arima import auto_arima

This works for me in a clean install, and has for others, so this is really my only hypothesis at the moment. Give it a try and let's see what happens...

charlesdrotar commented 6 years ago

@munitech4u The conda environment may be the way to go because of how conda installs inherently handles system package dependencies vs. pip installs - see SO post here. Not sure if/how you created the virtual environment and did your installs initially, but that may be the culprit as well.

munitech4u commented 6 years ago

@tgsmith61591 I tried following these instructions. pyramid_installation

Pyramid installation was successful. But it's throwing me error:

from pyramid.arima import auto_arima

ImportError: No module named 'pyramid.arima'

tgsmith61591 commented 6 years ago

I'm about out of ideas here. You do have your environment sourced when you launch your python prompt, right?... I can't replicate, and we do all of our windows builds on Appveyor, so we know they have to pass in order to be built & released. Try one more thing.

(pmdissue23) $ conda list
# packages in environment at //anaconda/envs/pmdissue23:
#
ca-certificates           2017.08.26           ha1e5d58_0  
certifi                   2018.1.18                py35_0  
Cython                    0.28.1                    <pip>
intel-openmp              2018.0.0                      8  
libcxx                    4.0.1                h579ed51_0  
libcxxabi                 4.0.1                hebd6815_0  
libedit                   3.1                  hb4e282d_0  
libffi                    3.2.1                h475c297_4  
libgfortran               3.0.1                h93005f0_2  
mkl                       2018.0.2                      1  
ncurses                   6.0                  hd04f020_2  
numpy                     1.14.2           py35ha9ae307_0  
openssl                   1.0.2n               hdbc3d79_0  
pandas                    0.22.0           py35h0a44026_0  
patsy                     0.5.0                    py35_0  
pip                       9.0.1                    py35_5  
pyramid-arima             0.6.2                     <pip>
python                    3.5.5                hc167b69_1  
python-dateutil           2.7.0                    py35_0  
pytz                      2018.3                   py35_0  
readline                  7.0                  hc1231fa_4  
scikit-learn              0.19.1           py35h2b554eb_0  
scipy                     1.0.0            py35h8b35106_0  
setuptools                38.5.1                   py35_0  
six                       1.11.0           py35h39a4c60_1  
sqlite                    3.22.0               h3efe00b_0  
statsmodels               0.8.0            py35ha7c9052_0  
tk                        8.6.7                h35a86e2_3  
wheel                     0.30.0           py35h5c0b906_1  
xz                        5.2.3                h0278029_2  
zlib                      1.2.11               hf3cbc9b_2  
munitech4u commented 6 years ago

pyramid_installation

munitech4u commented 6 years ago

I think the problem is , it's using libraries from default location: //Anaconda3/Lib/site-packages. I need to have them sourced from //Anaconda3/envs/pmdissue23/Lib/site-packages.

tgsmith61591 commented 6 years ago

That's why I asked if you'd sourced your environment before running your python commands. Closing for now, since by all accounts this should be working and I cannot replicate. If problems persist, we can re-open.

jamie85 commented 6 years ago

Hi,

Apologies for commenting on a closed issues, but I am trying to install pyramid-arima in anaconda so that I can use it in my jupyter notebooks.

I am on a mac, and have followed all the instructions above.

When I type into a Jupyter notebook:

from pyramid.arima import auto_arima

I get this error:

ModuleNotFoundError: No module named 'pyramid'

In terminal when I type conda list I do not get pyramid in the list that it outputs.

I have already typed into terminal pip install pyramid-arima and it installed fine without any problems, but for some reason it just isnt working inside jupyter notebooks

I'd appreciate any help

Thanks very much

tgsmith61591 commented 6 years ago

I suspect the environment you're installing the package into is not the one in which you're launching your python kernel. If you look at the pip installation log, where was the package installed into? If you're on a mac, there's a chance it may have installed into the default /System/Library/Frameworks/Python.framework/ location rather than into the /anaconda/... location. Can you confirm?

Otherwise, see this discussion around using Conda environments in your Jupyter notebooks

jamie85 commented 6 years ago

You are definitely right on that - I don't know how to check a pip installation log, but I typed pip install pyramid-arima directly into the terminal without loading any environments.

Infact I dont really know what environments are to tell you the truth - its never something I've had to deal with when creating notebooks.

In order to load a jupyter notebook up I open up terminal and type:

jupyter notebook

Please may I ask: how do I install pyramid directly into Anaconda Jupyter so that I don't need to learn/load environments everytime I want to start working in Jupyter?

Many thanks for all your help

jamie85 commented 6 years ago

Found a solution - posting it here, hopefully it helps somebody else out

On a mac type:

conda info --envs

This will show you the environment that you need to install pyramid into... for me it was just called 'base'

Then:

source activate base pip install pyramid-arima

You can then check it has installed properly by:

conda list

xiaoyTed commented 6 years ago

I think the problem is , it's using libraries from default location: //Anaconda3/Lib/site-packages. I need to have them sourced from //Anaconda3/envs/pmdissue23/Lib/site-packages.

hello, how to change the path?

divyajyotisingh01 commented 5 years ago

failed building wheels of pyramid arima??? why this error is shown

tgsmith61591 commented 5 years ago

@divyajyotisingh01 the pyramid namespace is deprecated and has migrated to pmdarima. Try pip installing that. See #34 for more info.

divyajyotisingh01 commented 5 years ago

@divyajyotisingh01 the pyramid namespace is deprecated and has migrated to pmdarima. Try pip installing that. See #34 for more info.

Thank you

divyajyotisingh01 commented 5 years ago

ModuleNotFoundError Traceback (most recent call last)

in ----> 1 from pyramid.arima import auto_arima 2 3 data = df.sort_index(ascending=True, axis=0) 4 5 train = data[:987] ModuleNotFoundError: No module named 'pyramid' this type of error still showing in jupyter nootbook.
tgsmith61591 commented 5 years ago

Because you're still importing from pyramid. Import from pmdarima. And please read the docs...

divyajyotisingh01 commented 5 years ago

Untitled2

ValueError Traceback (most recent call last) in ----> 1 from pmdarima.arima import auto_arima 2 3 data = df.sort_index(ascending=True, axis=0) 4 5 train = data[:987] sorry, but still, im trying to import auto arima but it is not working

On Sun, Mar 31, 2019 at 8:59 PM Taylor G Smith notifications@github.com wrote:

@divyajyotisingh01 https://github.com/divyajyotisingh01 the pyramid namespace is deprecated and has migrated to pmdarima. Try pip installing that. See #34 https://github.com/tgsmith61591/pmdarima/issues/34 for more info.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tgsmith61591/pmdarima/issues/23#issuecomment-478351599, or mute the thread https://github.com/notifications/unsubscribe-auth/AtjxVn9xT9Ot-1YZ6PMByr-L5TA9Godzks5vcNRegaJpZM4S8nf3 .

aaronreidsmith commented 5 years ago

It's hard to tell from your stacktrace (due to lack of complete stacktrace and formatting), but I see a ValueError, not a ModuleNotFoundError or ImportError, meaning the package imported successfully

aaronreidsmith commented 5 years ago

@divyajyotisingh01 What version of numpy are you using? Try running pip install --upgrade numpy and see if the error goes away.

https://github.com/scikit-learn-contrib/hdbscan/issues/272#issuecomment-453958532

divyajyotisingh01 commented 5 years ago

Yes

On Sun 31 Mar, 2019, 10:22 PM Aaron Smith, notifications@github.com wrote:

@divyajyotisingh01 https://github.com/divyajyotisingh01 What version of numpy are you using? Try running pip install --upgrade numpy and see if the error goes away.

scikit-learn-contrib/hdbscan#272 (comment) https://github.com/scikit-learn-contrib/hdbscan/issues/272#issuecomment-453958532

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tgsmith61591/pmdarima/issues/23#issuecomment-478358367, or mute the thread https://github.com/notifications/unsubscribe-auth/AtjxVjRIKvWp4ftN4zCyEZs8FVvlTm5Vks5vcOe3gaJpZM4S8nf3 .

divyajyotisingh01 commented 5 years ago

I'm new

On Sun 31 Mar, 2019, 11:09 PM Divya Jyoti, divyajyotisingh01@gmail.com wrote:

Yes

On Sun 31 Mar, 2019, 10:22 PM Aaron Smith, notifications@github.com wrote:

@divyajyotisingh01 https://github.com/divyajyotisingh01 What version of numpy are you using? Try running pip install --upgrade numpy and see if the error goes away.

scikit-learn-contrib/hdbscan#272 (comment) https://github.com/scikit-learn-contrib/hdbscan/issues/272#issuecomment-453958532

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tgsmith61591/pmdarima/issues/23#issuecomment-478358367, or mute the thread https://github.com/notifications/unsubscribe-auth/AtjxVjRIKvWp4ftN4zCyEZs8FVvlTm5Vks5vcOe3gaJpZM4S8nf3 .

tgsmith61591 commented 5 years ago

We're going to need some more info here or we can't help you. In the issue template, we ask for a complete stacktrace. @aaronreidsmith is correct that you're now getting a ValueError, and so this is probably something else, but we can't help you unless you give us the proper information.

divyajyotisingh01 commented 5 years ago

Actually I'm working in project where I use LSTM and Auto arima but they not able to work

On Sun, Mar 31, 2019 at 11:43 PM Taylor G Smith notifications@github.com wrote:

We're going to need some more info here or we can't help you. In the issue template, we ask for a complete stacktrace. @aaronreidsmith https://github.com/aaronreidsmith is correct that you're now getting a ValueError, and so this is probably something else, but we can't help you unless you give us the proper information.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tgsmith61591/pmdarima/issues/23#issuecomment-478364819, or mute the thread https://github.com/notifications/unsubscribe-auth/AtjxVrqeat_o6vDKh8dHUHmqYgdsYWy2ks5vcPrhgaJpZM4S8nf3 .

tgsmith61591 commented 5 years ago

@divyajyotisingh01, I understand you are new and this is frustrating. But you must see how comments like they are not able to work are difficult for us to help with? We need very specific information.

On git issues, we like to keep things focused. This has strayed pretty far from the topic of the original issue. I'm going to lock comments. Will you please file a new issue with extremely thorough information? The issue template shows what we ask for. The more info you give the developers, the more we can help. But we are not clairvoyant!

Instructions for filing: https://www.alkaline-ml.com/pmdarima/contributing.html#filing-bugs