Discussion:
[Scikit-learn-general] ValueError: numpy.dtype has the wrong size, try recompiling
Laura Fava
2016-02-25 15:40:10 UTC
Permalink
Hi,


I have installed scikit-learn, but I cannot import it because I am receiving the following error:


$ nosetests -v sklearn

Failure: ValueError (numpy.dtype has the wrong size, try recompiling) ... ERROR


======================================================================

ERROR: Failure: ValueError (numpy.dtype has the wrong size, try recompiling)

----------------------------------------------------------------------

Traceback (most recent call last):

File "/Library/Python/2.7/site-packages/nose/loader.py", line 407, in loadTestsFromName

module = resolve_name(addr.module)

File "/Library/Python/2.7/site-packages/nose/util.py", line 312, in resolve_name

module = __import__('.'.join(parts_copy))

File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57, in <module>

from .base import clone

File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in <module>

from .utils.fixes import signature

File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py", line 10, in <module>

from .murmurhash import murmurhash3_32

File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)

ValueError: numpy.dtype has the wrong size, try recompiling


----------------------------------------------------------------------

Ran 1 test in 0.001s


FAILED (errors=1)

My operating system is OS X Yosemite version 10.10.5.
numpy version: 1.10.4
scipy version: 0.17.0
scikit-learn version: 0.17.1

I used pip install -U scikit-learn.

I've tried uninstalling and reinstalling scipy (and numpy) and scikit-learn, but I still get the same error. I appreciate any help in how I can get a working installation of scikit-learn.

Thank you,
Laura
Andreas Mueller
2016-02-25 16:27:24 UTC
Permalink
How did you install numpy, scipy and scikit-learn?
I guess using wheels for all (and not compiling anything) should work.
Or use anaconda.

Also make sure all the libraries you are installing work in the same
python environment.

On 02/25/2016 10:40 AM, Laura Fava wrote:
>
> Hi,
>
>
> I have installed scikit-learn, but I cannot import it because I am
> receiving the following error:
>
>
> $ nosetests -v sklearn
>
> Failure: ValueError (numpy.dtype has the wrong size, try recompiling)
> ... ERROR
>
>
> ======================================================================
>
> ERROR: Failure: ValueError (numpy.dtype has the wrong size, try
> recompiling)
>
> ----------------------------------------------------------------------
>
> Traceback (most recent call last):
>
> File "/Library/Python/2.7/site-packages/nose/loader.py", line 407,
> in loadTestsFromName
>
> module = resolve_name(addr.module)
>
> File "/Library/Python/2.7/site-packages/nose/util.py", line 312, in
> resolve_name
>
> module = __import__('.'.join(parts_copy))
>
> File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line
> 57, in <module>
>
> from .base import clone
>
> File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11,
> in <module>
>
> from .utils.fixes import signature
>
> File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py",
> line 10, in <module>
>
> from .murmurhash import murmurhash3_32
>
> File "numpy.pxd", line 155, in init sklearn.utils.murmurhash
> (sklearn/utils/murmurhash.c:5029)
>
> ValueError: numpy.dtype has the wrong size, try recompiling
>
>
> ----------------------------------------------------------------------
>
> Ran 1 test in 0.001s
>
>
> FAILED (errors=1)
>
>
> My operating system is OS X Yosemite version 10.10.5.
> numpy version: 1.10.4
> scipy version: 0.17.0
> scikit-learn version: 0.17.1
>
> I used pip install -U scikit-learn.
>
> I've tried uninstalling and reinstalling scipy (and numpy) and
> scikit-learn, but I still get the same error. I appreciate any help
> in how I can get a working installation of scikit-learn.
>
> Thank you,
> Laura
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>
>
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
Laura Fava
2016-02-25 17:34:24 UTC
Permalink
I installed all the packages using pip install. I already had numpy and scipy installed, but when installing scikit-learn didn't work, I uninstalled scikit-learn, numpy and scipy, then reinstalled scipy, which reinstalled numpy, then reinstalled scikit-learn. When that didn't work, I uninstalled the three packages and tried doing them together as pip install -U numpy scipy scikit-learn. That didn't work either.


I don't want to move to Anaconda, because I have a number of other packages I use already set up via pip and would prefer to continue on that route.


________________________________
From: Andreas Mueller <***@gmail.com>
Sent: Thursday, February 25, 2016 8:27 AM
To: scikit-learn-***@lists.sourceforge.net
Subject: Re: [Scikit-learn-general] ValueError: numpy.dtype has the wrong size, try recompiling

How did you install numpy, scipy and scikit-learn?
I guess using wheels for all (and not compiling anything) should work.
Or use anaconda.

Also make sure all the libraries you are installing work in the same python environment.

On 02/25/2016 10:40 AM, Laura Fava wrote:

Hi,


I have installed scikit-learn, but I cannot import it because I am receiving the following error:


$ nosetests -v sklearn

Failure: ValueError (numpy.dtype has the wrong size, try recompiling) ... ERROR


======================================================================

ERROR: Failure: ValueError (numpy.dtype has the wrong size, try recompiling)

----------------------------------------------------------------------

Traceback (most recent call last):

File "/Library/Python/2.7/site-packages/nose/loader.py", line 407, in loadTestsFromName

module = resolve_name(addr.module)

File "/Library/Python/2.7/site-packages/nose/util.py", line 312, in resolve_name

module = __import__('.'.join(parts_copy))

File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57, in <module>

from .base import clone

File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in <module>

from .utils.fixes import signature

File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py", line 10, in <module>

from .murmurhash import murmurhash3_32

File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)

ValueError: numpy.dtype has the wrong size, try recompiling


----------------------------------------------------------------------

Ran 1 test in 0.001s


FAILED (errors=1)

My operating system is OS X Yosemite version 10.10.5.
numpy version: 1.10.4
scipy version: 0.17.0
scikit-learn version: 0.17.1

I used pip install -U scikit-learn.

I've tried uninstalling and reinstalling scipy (and numpy) and scikit-learn, but I still get the same error. I appreciate any help in how I can get a working installation of scikit-learn.

Thank you,
Laura
j***@gmail.com
2016-02-25 17:41:42 UTC
Permalink
On Thu, Feb 25, 2016 at 12:34 PM, Laura Fava <***@outlook.com> wrote:

> I installed all the packages using pip install. I already had numpy and
> scipy installed, but when installing scikit-learn didn't work, I
> uninstalled scikit-learn, numpy and scipy, then reinstalled scipy, which
> reinstalled numpy, then reinstalled scikit-learn. When that didn't work, I
> uninstalled the three packages and tried doing them together as pip
> install -U numpy scipy scikit-learn. That didn't work either.
>

you need to check which version of numpy scikit-learn is compiled against,
and get a numpy version that is not older.
At least that's the most common source for that error message

http://stackoverflow.com/questions/17709641/valueerror-numpy-dtype-has-the-wrong-size-try-recompiling/18369312#18369312

Josef


>
> I don't want to move to Anaconda, because I have a number of other
> packages I use already set up via pip and would prefer to continue on that
> route.
>
>
> ------------------------------
> *From:* Andreas Mueller <***@gmail.com>
> *Sent:* Thursday, February 25, 2016 8:27 AM
> *To:* scikit-learn-***@lists.sourceforge.net
> *Subject:* Re: [Scikit-learn-general] ValueError: numpy.dtype has the
> wrong size, try recompiling
>
> How did you install numpy, scipy and scikit-learn?
> I guess using wheels for all (and not compiling anything) should work.
> Or use anaconda.
>
> Also make sure all the libraries you are installing work in the same
> python environment.
>
> On 02/25/2016 10:40 AM, Laura Fava wrote:
>
> Hi,
>
>
> I have installed scikit-learn, but I cannot import it because I am
> receiving the following error:
>
>
> $ nosetests -v sklearn
>
> Failure: ValueError (numpy.dtype has the wrong size, try recompiling) ...
> ERROR
>
>
> ======================================================================
>
> ERROR: Failure: ValueError (numpy.dtype has the wrong size, try
> recompiling)
>
> ----------------------------------------------------------------------
>
> Traceback (most recent call last):
>
> File "/Library/Python/2.7/site-packages/nose/loader.py", line 407, in
> loadTestsFromName
>
> module = resolve_name(addr.module)
>
> File "/Library/Python/2.7/site-packages/nose/util.py", line 312, in
> resolve_name
>
> module = __import__('.'.join(parts_copy))
>
> File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57,
> in <module>
>
> from .base import clone
>
> File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in
> <module>
>
> from .utils.fixes import signature
>
> File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py", line
> 10, in <module>
>
> from .murmurhash import murmurhash3_32
>
> File "numpy.pxd", line 155, in init sklearn.utils.murmurhash
> (sklearn/utils/murmurhash.c:5029)
>
> ValueError: numpy.dtype has the wrong size, try recompiling
>
>
> ----------------------------------------------------------------------
>
> Ran 1 test in 0.001s
>
>
> FAILED (errors=1)
>
> My operating system is OS X Yosemite version 10.10.5.
> numpy version: 1.10.4
> scipy version: 0.17.0
> scikit-learn version: 0.17.1
>
> I used pip install -U scikit-learn.
>
> I've tried uninstalling and reinstalling scipy (and numpy) and
> scikit-learn, but I still get the same error. I appreciate any help in how
> I can get a working installation of scikit-learn.
>
> Thank you,
> Laura
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>
>
>
> _______________________________________________
> Scikit-learn-general mailing listScikit-learn-***@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
Laura Fava
2016-02-25 19:31:21 UTC
Permalink
It looks like I have another, older version of numpy installed in a path was earlier in the sys.path list. I set my PYTHONPATH to the path where pip installs the site-packages, and that has allowed scikit-learn to compile against the latest version of numpy. I have now successfully installed scikit-learn.


Thanks,

Laura


________________________________
From: ***@gmail.com <***@gmail.com>
Sent: Thursday, February 25, 2016 9:41 AM
To: scikit-learn-***@lists.sourceforge.net
Subject: Re: [Scikit-learn-general] ValueError: numpy.dtype has the wrong size, try recompiling



On Thu, Feb 25, 2016 at 12:34 PM, Laura Fava <***@outlook.com<mailto:***@outlook.com>> wrote:

I installed all the packages using pip install. I already had numpy and scipy installed, but when installing scikit-learn didn't work, I uninstalled scikit-learn, numpy and scipy, then reinstalled scipy, which reinstalled numpy, then reinstalled scikit-learn. When that didn't work, I uninstalled the three packages and tried doing them together as pip install -U numpy scipy scikit-learn. That didn't work either.

you need to check which version of numpy scikit-learn is compiled against, and get a numpy version that is not older.
At least that's the most common source for that error message

http://stackoverflow.com/questions/17709641/valueerror-numpy-dtype-has-the-wrong-size-try-recompiling/18369312#18369312

Josef



I don't want to move to Anaconda, because I have a number of other packages I use already set up via pip and would prefer to continue on that route.


________________________________
From: Andreas Mueller <***@gmail.com<mailto:***@gmail.com>>
Sent: Thursday, February 25, 2016 8:27 AM
To: scikit-learn-***@lists.sourceforge.net<mailto:scikit-learn-***@lists.sourceforge.net>
Subject: Re: [Scikit-learn-general] ValueError: numpy.dtype has the wrong size, try recompiling

How did you install numpy, scipy and scikit-learn?
I guess using wheels for all (and not compiling anything) should work.
Or use anaconda.

Also make sure all the libraries you are installing work in the same python environment.

On 02/25/2016 10:40 AM, Laura Fava wrote:

Hi,


I have installed scikit-learn, but I cannot import it because I am receiving the following error:


$ nosetests -v sklearn

Failure: ValueError (numpy.dtype has the wrong size, try recompiling) ... ERROR


======================================================================

ERROR: Failure: ValueError (numpy.dtype has the wrong size, try recompiling)

----------------------------------------------------------------------

Traceback (most recent call last):

File "/Library/Python/2.7/site-packages/nose/loader.py", line 407, in loadTestsFromName

module = resolve_name(addr.module)

File "/Library/Python/2.7/site-packages/nose/util.py", line 312, in resolve_name

module = __import__('.'.join(parts_copy))

File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line 57, in <module>

from .base import clone

File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11, in <module>

from .utils.fixes import signature

File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py", line 10, in <module>

from .murmurhash import murmurhash3_32

File "numpy.pxd", line 155, in init sklearn.utils.murmurhash (sklearn/utils/murmurhash.c:5029)

ValueError: numpy.dtype has the wrong size, try recompiling


----------------------------------------------------------------------

Ran 1 test in 0.001s


FAILED (errors=1)

My operating system is OS X Yosemite version 10.10.5.
numpy version: 1.10.4
scipy version: 0.17.0
scikit-learn version: 0.17.1

I used pip install -U scikit-learn.

I've tried uninstalling and reinstalling scipy (and numpy) and scikit-learn, but I still get the same error. I appreciate any help in how I can get a working installation of scikit-learn.

Thank you,
Laura



------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140



_______________________________________________
Scikit-learn-general mailing list
Scikit-learn-***@lists.sourceforge.net<mailto:Scikit-learn-***@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
Andreas Mueller
2016-02-25 17:41:41 UTC
Permalink
Try completely removing the numpy, scipy and scikit-learn folders, then
``pip install numpy scipy``, then ``pip install scikit-learn``.


On 02/25/2016 12:34 PM, Laura Fava wrote:
>
> I installed all the packages using pip install. I already had numpy
> and scipy installed, but when installing scikit-learn didn't work, I
> uninstalled scikit-learn, numpy and scipy, then reinstalled scipy,
> which reinstalled numpy, then reinstalled scikit-learn. When that
> didn't work, I uninstalled the three packages and tried doing them
> together as pip install -U numpy scipy scikit-learn. That didn't work
> either.
>
>
> I don't want to move to Anaconda, because I have a number of other
> packages I use already set up via pip and would prefer to continue on
> that route.
>
>
>
> ------------------------------------------------------------------------
> *From:* Andreas Mueller <***@gmail.com>
> *Sent:* Thursday, February 25, 2016 8:27 AM
> *To:* scikit-learn-***@lists.sourceforge.net
> *Subject:* Re: [Scikit-learn-general] ValueError: numpy.dtype has the
> wrong size, try recompiling
> How did you install numpy, scipy and scikit-learn?
> I guess using wheels for all (and not compiling anything) should work.
> Or use anaconda.
>
> Also make sure all the libraries you are installing work in the same
> python environment.
>
> On 02/25/2016 10:40 AM, Laura Fava wrote:
>>
>> Hi,
>>
>>
>> I have installed scikit-learn, but I cannot import it because I am
>> receiving the following error:
>>
>>
>> $ nosetests -v sklearn
>>
>> Failure: ValueError (numpy.dtype has the wrong size, try recompiling)
>> ... ERROR
>>
>>
>> ======================================================================
>>
>> ERROR: Failure: ValueError (numpy.dtype has the wrong size, try
>> recompiling)
>>
>> ----------------------------------------------------------------------
>>
>> Traceback (most recent call last):
>>
>> File "/Library/Python/2.7/site-packages/nose/loader.py", line 407,
>> in loadTestsFromName
>>
>> module = resolve_name(addr.module)
>>
>> File "/Library/Python/2.7/site-packages/nose/util.py", line 312, in
>> resolve_name
>>
>> module = __import__('.'.join(parts_copy))
>>
>> File "/Library/Python/2.7/site-packages/sklearn/__init__.py", line
>> 57, in <module>
>>
>> from .base import clone
>>
>> File "/Library/Python/2.7/site-packages/sklearn/base.py", line 11,
>> in <module>
>>
>> from .utils.fixes import signature
>>
>> File "/Library/Python/2.7/site-packages/sklearn/utils/__init__.py",
>> line 10, in <module>
>>
>> from .murmurhash import murmurhash3_32
>>
>> File "numpy.pxd", line 155, in init sklearn.utils.murmurhash
>> (sklearn/utils/murmurhash.c:5029)
>>
>> ValueError: numpy.dtype has the wrong size, try recompiling
>>
>>
>> ----------------------------------------------------------------------
>>
>> Ran 1 test in 0.001s
>>
>>
>> FAILED (errors=1)
>>
>>
>> My operating system is OS X Yosemite version 10.10.5.
>> numpy version: 1.10.4
>> scipy version: 0.17.0
>> scikit-learn version: 0.17.1
>>
>> I used pip install -U scikit-learn.
>>
>> I've tried uninstalling and reinstalling scipy (and numpy) and
>> scikit-learn, but I still get the same error. I appreciate any help
>> in how I can get a working installation of scikit-learn.
>>
>> Thank you,
>> Laura
>>
>>
>> ------------------------------------------------------------------------------
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>>
>>
>> _______________________________________________
>> Scikit-learn-general mailing list
>> Scikit-learn-***@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
>
>
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>
>
> _______________________________________________
> Scikit-learn-general mailing list
> Scikit-learn-***@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/scikit-learn-general
Loading...