import yfinance issue - numpy dependency problem? Need to uninstall then reinstall numpy every time. Code works from CLI, but not in PyCharm - numpy

I am trying to use the yfinance module. I have a venv set up. If I run my code from the command line it works. If I run it inside PyCharm it throws this import error. Doing pip uninstall -y numpy and then pip install numpy fixes the problem, but I have to do this every day. I'm very confused on what is the issue. Anyone have any tips?
It is failing at literally the first line of code which is the import yfinance line. Here is the traceback:
Traceback (most recent call last):
File "/Users/MikeGuglielmo/Desktop/python_code.py/python_distilled/practice.py/main.py", line 1, in
import yfinance as yf
File "/Users/MikeGuglielmo/Desktop/python_code.py/options_project/venv/lib/python3.9/site-packages/yfinance/init.py", line 23, in
from .ticker import Ticker
File "/Users/MikeGuglielmo/Desktop/python_code.py/options_project/venv/lib/python3.9/site-packages/yfinance/ticker.py", line 27, in
import pandas as _pd
File "/Users/MikeGuglielmo/Desktop/python_code.py/options_project/venv/lib/python3.9/site-packages/pandas/init.py", line 16, in
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
The Python version is: Python3.9 from "/Users/MikeGuglielmo/Desktop/python_code.py/options_project/venv/bin/python"
The NumPy version is: "1.23.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'

Related

Why is import pandas giving me an error message?

Hi I have installed pandas into my virtual environment in VS Code. I can import other modules that came when pip installed pandas(numpy) but it gives me:
Traceback (most recent call last):
File "/Users/aidan/VS_Studios/Graphing Data/main.py", line 2, in <module>
import pandas as pd
ImportError: No module named pandas
When I try and import pandas into my main.py file. This is my virtual environment:
I have wheels installed and have python running on 3.11.8 and everything is local.
Please help thank you!
I have tried unistalling pandas and checking to see if both my interpreter pip and python are all on the same version, they are. IDK what else I need to do.

ImportError: No module named pandas [pycharm] python 3.7

I write the code like this:
import pandas as pd
import quandl
df = quandl.get('WIKI/GOOGL')
print(df.head())
and I have the error as below
C:\Users\Administrator\PycharmProjects\untitled1\venv\Scripts\python.exe C:/Users/Administrator/PycharmProjects/untitled1/regression.py
Traceback (most recent call last):
File "C:/Users/Administrator/PycharmProjects/untitled1/regression.py", line 1, in
import pandas as pd
ModuleNotFoundError: No module named 'pandas'
Process finished with exit code 1
I tried to test many recommendations from the internet, but I cannot fix this error. Please help me! Thank you so much.
If you are using bare python install pandas using pip "pip install pandas", If you are using anaconda, check your python interpreter from pycharm. Go to File->Settings->Project Settings->Project Interpreter->Python Interpreters Ensure to select correct version of python.exe e.g C:\Program Files\Python37\python.exe for bare python (For this you need to install pandas ) For anaconda you'll see C:\Users\xxx\AppData\Local\Continuum\anaconda3\python.exe. select the correct interpreter and you are good to go

No module named 'pandastable'

I'm trying to change table wrote by me on tkinter with the pandastable one in order to do the handling of data directly from a pandas.DataFrame.
But despite I have already installed Anaconda3 with matlplotlib, numpy, pandas ect. modules when i would like to import pandastable I have trouble.
This is the problem:
import pandastable
Traceback (most recent call last):
File "<pyshell#8>", line 1, in <module>
import pandastable
ImportError: No module named 'pandastable'
pip install pandastable
Requires python>=3.3 or 2.7 and numpy, matplotlib and pandas.
See: pandastable on github
edit: You may have multiple Python environments installed on your machine. Anaconda uses conda install to keep things in check but pandastable doesn't seem to be available through Anaconda packages. Make sure you are installing to the same Python environment that your script uses. You might also try:
pip3 install pandastable

faulty install of Matplotlib

Windows7 with python 3.4 32bit.
Downloaded and ran install according to this related question.
However I have a different error, so I posted a new question.
I removed the faulty install and tried the installer from the sourceforge link off matplotlib.org. Both finish claiming to be successful, though testing results in an error (both resulting in the same error)
from matplotlib import *
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from matplotlib import *
File "C:\Python34\lib\site-packages\matplotlib\__init__.py", line 105, in <module>
import six
ImportError: No module named 'six'
Actually you need to install six. As given in Python Error: "ImportError: No module named six"
Better you can install pip and install all libraries using that.

Numpy Install Mac Osx Python

I am using Python for my Linear Algebra course for programming. For the tools we need, I am trying to install NumPy. I used this website to guide me through the installation process.
I started from the links on SciPy's OS X page and eventually arrived at the SourceForge download site.
From there, I chose the Mac OS X installer numpy-1.6.1-py2.7-python.org-macosx10.3.dmg.
When I went to Idle and typed in
>>> import numpy as np
This is the error I received:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/__init__.py", line 137, in <module>
import add_newdocs
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/add_newdocs.py", line 9, in <module>
from numpy.lib import add_newdoc
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/__init__.py", line 4, in <module>
from type_check import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/lib/type_check.py", line 8, in <module>
import numpy.core.numeric as _nx
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/__init__.py", line 5, in <module>
import multiarray
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so, 2): no suitable image found. Did find:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/multiarray.so: no matching architecture in universal wrapper
I also tried it from the terminal and got the same error. I have a virtual environment installed - virtual env wrapper. I called the environment in the terminal by:
source my_new_env/bin/activate
And then I tried to import numpy in the terminal that way, but then I got the error:
(my_new_env) $ sudo python -c 'import numpy; numpy.test()'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named numpy
I am not sure if I installed NumPy incorrectly or if my virtual environment is conflicting with Nose. If anyone has suggestions let me know!
i would skip the MacOS package install and use the 'pip install' instructions, since you're already familiar with virtualenvs. use these instructions instead: http://www.scipy.org/install.html#installing-via-pip
it's easier to work with a virtualenv and pip, which will ensure post-install that your virtualenv will have access to the modules you've installed. it takes more work to do that with an external package (or .dmg) that you've downloaded. not impossible, just more work. HTH.
Try these commands:
brew update, brew doctor
, because, in my case, I didn't even have to install numpy separately. Yet I could import numpy easily. Meanwhile you can try downloading the numpy package from this website.