alvarobartt / investpy

Financial Data Extraction from Investing.com with Python
https://investpy.readthedocs.io/
MIT License
1.63k stars 377 forks source link

AttributeError: module 'numpy.core' has no attribute 'numerictypes' #432

Closed AureliusMarcusHu closed 2 years ago

AureliusMarcusHu commented 3 years ago

Hi Guys,

I'm very new in python and in I have installed investpy by pip. I get the notes all dependent packages are installed succesfully included investpy. I always get an error from numpy when I run the command [investpy.get_stock_information(stock='AAPL', country='United States', as_json=True)]

File "C:\Program Files (x86)\Python39-32\lib\site-packages\numpy__init__.py", line 200, in core.numerictypes.typeDict, AttributeError: module 'numpy.core' has no attribute 'numerictypes'

I have uninstalled and reinstalled the packages whitout succes. Always the same error. Can someone help me please, what do I wrong ?

Thanks in advance.

ghost commented 3 years ago

I am facing the same issue. Please help!

alvarobartt commented 3 years ago

Hi @AureliusMarcusHu and @lone-wolf07 :hugs:

Thanks for reporting this issue! Are you both using Python 3.9? Which OS? And, finally, can you check which numpy version do you have installed?

Once you provide me that information I'll solve this ASAP :+1:

alvarobartt commented 3 years ago

Besides that, can you try to re-install numpy as it follows pip install numpy -U

nathan3leaf commented 2 years ago

I'm assuming this is still in the broken phase?

alvarobartt commented 2 years ago

Hi @nathan3leaf, can you provide me more details? I think this is not happening anymore, just that the issue was not closed back in the day.

Is this function the one that is failing?

information = investpy.get_stock_information(stock='AAPL', country='United States', as_json=True)

Thanks! :hugs:

nathan3leaf commented 2 years ago

@alvarobartt I did encounter it, but just gave in and updated to python 3.9 and it's not occurring anymore. I believe I experienced it when I was on 3.6 but to be honest I don't recall all the circumstances that went into it popping up. It may have been related to the arcgis package, but again, sadly I don't recall. Thank you for your time though and for the quick reply.

vmendezs commented 2 years ago

Hey guys, I was having the same problem but then I made the next changes and it works for me:

  1. Check the version of numpy and tensorflow with pip show numpy and pip show tensorflow (in my case I have 1.19.5 for numpy and 2.6.0 for tensorflow)
  2. Also check the version of python, it is not necessary but just in case that you were working on python2.7 it won't work
  3. Restart your machine, it helps the system to save the changes for the version of the packages In case you don't know how to change the version of the packages, I changed them on the terminal with python3 -m pip install numpy=1.19.5

Hope it works for u, bye.

alvarobartt commented 2 years ago

Thanks for your suggestion @vmendezs, I'll try to re-run the unit tests with the latest version of numpy to see whether that works or not, and as soon as the unit tests are working I'll consider this issue closed. 👍🏻

GiorgioPeng commented 2 years ago

Well, I have the same problem, but I've solved it by a method like the solution from @vmendezs.

  1. The first key is to install the right version of "numpy". For example, I have checked the 1.19.5 version, and there is a "numerictypes.py" (at path ~/anaconda3/lib/python3.8/site-packages/numpy/core/) in numpy.
  2. The second key is restart the conda environment. (I tried switching to another conda environment, and then switching back.) Hope these tips can help u.
alvarobartt commented 2 years ago

Thanks for the information @GiorgioPeng! :hugs: Closing this for now, hopefully, everything's solved already!