Problems with NumPy version with Python 3.10 - python

Need help please with fixing the NumPy problem I have. Tried to fix it for 2 days and didn't get far.
I have installed Python 3.10. I am using PyCharm.
When I debug my app I keep on getting the following error:
{Traceback (most recent call last):\r\n File \"C:\\Users\\Administrator\\PycharmProjects\\PaySlip_New\\main.py\", line 2, in <module>\r\n
from src.common.ParserFactory import ParserFactory\r\n
File \"C:\\Users\\Administrator\\PycharmProjects\\PaySlip_New\\src\\common\\ParserFactory.py\", line 1, in <module>\r\n
from src.parsers.regular_parser import Parser\r\n File \"C:\\Users\\Administrator\\PycharmProjects\\PaySlip_New\\src\\parsers\\regular_parser.py\", line 1, in <module>\r\n from src.common.ParserMain import ParserMain\r\n File \"C:\\Users\\Administrator\\PycharmProjects\\PaySlip_New\\src\\common\\ParserMain.py\", line 1, in <module>\r\n
import pandas as pd\r\n File \"C:\\Users\\Administrator\\PycharmProjects\\PaySlip_New\\venv\\lib\\site-packages\\pandas\\__init__.py\",
line 16, in <module>\r\n
raise ImportError(\r\nImportError: Unable to import required dependencies:\r\nnumpy: \r\n\r\nIMPORTANT:
PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!\r\n\r\nImporting the numpy C-extensions failed.
This error can happen for\r\nmany reasons, often due to issues with your setup or how NumPy was\r\ninstalled.\r\n\r\nWe
have compiled some common reasons and troubleshooting tips at:\r\n\r\n
https://numpy.org/devdocs/user/troubleshooting-importerror.html\r\n\r\nPlease note and check the following:\r\n\r\n * T
he Python version is: Python3.10 from \"C:\\Users\\Administrator\\PycharmProjects\\PaySlip_New\\venv\\Scripts\\python.exe\"\r\n
* The NumPy version is: \"1.19.4\"\r\n\r\nand make sure that they are the versions you expect.\r\nPlease carefully study the documentation
linked above for further help.\r\n\r\nOriginal error was: No module named 'numpy.core._multiarray_umath'\r\n\r\n}
When I run cmd version I get this:
C:\Users\Administrator>pip3 show numpy
Name: numpy
Version: 1.21.4
pypvenv.cfg
home = C:\Users\Administrator\AppData\Local\Programs\Python\Python310
implementation = CPython
version_info = 3.10.6.final.0
virtualenv = 20.13.0
Please help me. Thank you!

The error message says "Numpy version is 1.19.4", but you expect it to be version 1.21.4. Your pandas version seems to be incompatible with numpy 1.19.4.

Related

CRONTAB on MAC --> ImportError: Unable to import required dependencies: numpy:

After years of reading upon questions and all of your help here on Stack I am now officially a member :)
I am building a script using pandas (for data handling) and want to export this data to excel using df.to_excel(writer) using pd.ExcelWriter.
Scheduling raw python jobs with CronTab is all going fine, tested using * * * * * so the output from the open('x.csv', 'w') as file.... all worked ok.
My Python version is 3.9.7 and the Numpy is 1.21.2
The problem arises when I use the CronTab scheduler on a python script using Pandas and the mail says:
*Traceback (most recent call last):
File "main.py", line 1, in
import pandas as pd
File "/Users/THIS IS ME/Library/Python/3.8/lib/python/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.8 from "/Library/Developer/CommandLineTools/usr/bin/python3"
The NumPy version is: "1.21.2"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.***

How does one update Python through the terminal on WinSCP?

I am trying to run a script which involves numpy through the terminal on WinSCP, but whenever I do, I get the following error:
import gensim
File "/data/work/worker/gensim/init.py", line 5, in
from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401
File "/data/work/worker/gensim/parsing/init.py", line 4, in
from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2, # noqa:F401
File "/data/work/worker/gensim/parsing/preprocessing.py", line 42, in
from gensim import utils
File "/data/work/worker/gensim/utils.py", line 38, in
import numpy as np
File "/data/work/worker/numpy/init.py", line 142, in
from . import core
File "/data/work/worker/numpy/core/init.py", line 50, in
raise ImportError(msg)
ImportError:
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: Python2.7 from "/usr/bin/python"
The NumPy version is: "1.18.5"
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 _multiarray_umath>
I suspect that the issue is that the version of Python being quoted here is outdated; however, after having done some searching, I cannot find any literature on how to update Python on WinSCP. I have Python 3.8 installed on my machine, and I have tried moving the installer and the .exe file into the WinSCP directory to no avail. Is there any way to update python directly in the terminal? Alternately, is this issue actually nothing to do with a stale version of Python at all?

ImportError: cannot import name get_ast_names error on lmfit

I have recently updated to Ubuntu 18.04.1 LTS. After that I tried to run some of my python codes and I got an error related to the lmfit package, here's the code:
import scipy
from asteval import get_ast_names
import lmfit
(I have explicitly added the scipy and asteval modules to check python was finding them porperly)
I obtained this error:
Traceback (most recent call last):
File "/home/maurizio/Documents/Python/Programmini/PhD/TEAS/Test.py", line 3, in <module>
import lmfit
File "/home/maurizio/.local/lib/python2.7/site-packages/lmfit/__init__.py", line 42, in <module>
from .confidence import conf_interval, conf_interval2d
File "/home/maurizio/.local/lib/python2.7/site-packages/lmfit/confidence.py", line 12, in <module>
from .minimizer import MinimizerException
File "/home/maurizio/.local/lib/python2.7/site-packages/lmfit/minimizer.py", line 35, in <module>
from .parameter import Parameter, Parameters
File "/home/maurizio/.local/lib/python2.7/site-packages/lmfit/parameter.py", line 8, in <module>
from asteval import Interpreter, get_ast_names, valid_symbol_name
ImportError: cannot import name get_ast_names
which basically states that lmfit cannot find the function get_ast_names from asteval, although the python interpreter doesn't complain when I try to import it so it should be properly installed.
I have found this question with a similar problem and the guy in the comments claims he solved it by reinstalling it with pip3, so I tried to compile it with python3 and there's no problem so the issue concerns only python 2
Any help?
I believe you must have conflicting versions of lmfit and asteval. This should have been automatically noticed (and ideally resolved) when installing lmfit, but something there appears to have gone wrong. For the latest releases, you should get
>>> import asteval
>>> asteval.__version__
0.9.12
>>> import lmfit
>>> lmfit.__version__
0.9.11
Depending on how you installed these, you may need to check for and remove older versions of asteval in your $HOME/.local/lib/python2.7/site-packages/ folder and re-do pip install asteval.

runtime error when using sklearn in python3.2 (works fine in python 2.7) - how to fix it?

I am trying to learn sklearn and I encounter the below error when I run import sklearn . However, when I run the exact same code using python 2.7, I do not encounter any errors.
import sklearn
File "/usr/local/lib/python3.2/dist-packages/sklearn/__init__.py", line 38, in <module>
from .base import clone
File "/usr/local/lib/python3.2/dist-packages/sklearn/base.py", line 10, in <module>
from scipy import sparse
File "/usr/lib/python3/dist-packages/scipy/__init__.py", line 124, in <module>
pkgload(verbose=SCIPY_IMPORT_VERBOSE,postpone=True)
File "/usr/local/lib/python3.2/dist-packages/numpy/_import_tools.py", line 177, in __call__
for package_name in self._get_sorted_names():
File "/usr/local/lib/python3.2/dist-packages/numpy/_import_tools.py", line 114, in _get_sorted_names
for name in depend_dict.keys():
RuntimeError: dictionary changed size during iteration
I did some googl'ing and followed the instructions from the following link and ran sudo pip3 install git+https://github.com/scikit-learn/scikit-learn.git. The installation went fine, however, I continue to get the error.
https://askubuntu.com/questions/449326/installation-error-in-sklearn-for-python3
How does one go about fixing this issue. (other than working with Python2.7)
It's a bug that's that will be fixed in the next NumPy (v 1.9.0) release:
https://github.com/numpy/numpy/commit/5025c40965fa5fb2b591f07c152b966dc7b730f0
There is already a patch available on github, but it hasn't been bundled into a patch release yet. Your options:
Wait for the 1.9.0 release to fix for Python 3, and use Python 2 in the meantime.
Simply apply the same changes to the two lines in the link I provided to your current version of Numpy
Install Numpy 1.9.0 beta.

ImportError when installing NumPy for Python 2.7

EDIT: after reading this http://projects.scipy.org/numpy/ticket/1322 it seems that the NumPy version I am using doesn't work with Mac OS 10.5.x. Does anyone have access to a version of NumPy that works with Mac OS 10.5? I can't get it to compile either.
Original post ...
I am trying to use NumPy, but I'm having difficulty installing it. I'm using the installer that is available on sourceforge.
NumPy v1.5.0 (Py2.7)
Python 2.7
Mac OS 10.5.8 (PPC)
After running the installer (all I did was double-click the .pkg and follow the instructions), I try to import it ...
>>> import numpy
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import numpy
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nump/__init__.py", line 153, in <module>
import random
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/random/__init__.py", line 87, in <module>
from mtrand import *
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/random/mtrand.so, 2): Symbol not found: _fopen$UNIX2003
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/random/mtrand.so
Expected in: /usr/lib/libSystem.B.dylib
Does anyone have experience with this or have advice on how to fix it?
Thanks!
You can find discussion about current problems with Mac OS on the numpy mailing list, and I would recommend to discuss installation problems there, since that's were the developers are that try to fix the problems.
for example
http://groups.google.com/group/numpy/browse_thread/thread/a0ceb45b58feca2b#
and this is OS 10.5 specific
http://groups.google.com/group/numpy/browse_thread/thread/de75279785d56a25/2bfbb96e6d6c0a2e
You could join the effort, since they don't seem to have many OS 10.5 users available for testing.

Categories

Resources