I am running python3 on a Debian 10 (buster) system.
Up until yesterday, I was able to perform this import:
from metpy.plots import (StationPlot, StationPlotLayout, wx_code_map, current_weather)
After a general package update, I can no longer perform the import and instead get this string of errors:
Traceback (most recent call last): File
"/home/disk/bob/impacts/bin/ASOS_plot_data_hourly_ISU.py", line 37, in
from metpy.plots import (StationPlot, StationPlotLayout,
wx_code_map, current_weather) File
"/usr/lib/python3/dist-packages/metpy/init.py", line 35, in
from .xarray import * # noqa: F401, F403, E402 File
"/usr/lib/python3/dist-packages/metpy/xarray.py", line 27, in
from .units import DimensionalityError, UndefinedUnitError, units
File "/usr/lib/python3/dist-packages/metpy/units.py", line 40, in
lambda string: string.replace('%', 'percent') File
"/usr/lib/python3/dist-packages/pint/registry.py", line 74, in
call obj = super(_Meta, self).call(*args, **kwargs) TypeError: init() got an unexpected keyword argument
'preprocessors'
In fact, I can't even do a simple
import metpy
without getting the same error chain.
Obviously, there must be some sort of version discrepancy with xarray or some other package.
I currently have these versions installed: 1.0.0rc1.po of metpy and 0.12.1-1 of xarray.
Any thoughts about what the required combination of packages should be or who I might ask about this?
It's unclear from your post what versions of Pint and Python you have installed. From the error, it seems like you are having problems with too old a version of Pint installed, though MetPy 1.0.0rc1 should have had support to deal with that. Really, the whole 1.0.0rc1.po version makes me wonder almost if MetPy was installed from git at some point after rc1?
Regardless, MetPy 1.0.0rc1, which means that was the first Release Candidate for the 1.0 release of MetPy and is not a version I would rely upon. I would suggest updating to either MetPy 1.0.1 (if you are using Python 3.6) or MetPy 1.2 (for Python >= 3.7).
Related
I am trying to setup a legacy project using python 3.6.13 as a constraint. Though I am running into an issue trying to install pandas version 0.18.1
The log are as below:
Collecting numpy==1.11.1 (from -r requirements-remote.txt (line 25))
Using cached https://files.pythonhosted.org/packages/e0/4c/515d7c4ac424ff38cc919f7099bf293dd064ba9a600e1e3835b3edefdb18/numpy-1.11.1.tar.gz
Collecting pandas==0.18.1 (from -r requirements-remote.txt (line 26))
Using cached https://files.pythonhosted.org/packages/11/09/e66eb844daba8680ddff26335d5b4fead77f60f957678243549a8dd4830d/pandas-0.18.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 154, in save_modules
yield saved
File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 195, in setup_context
yield
File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 250, in run_setup
_execfile(setup_script, ns)
File "/Users/qqqqq/.pyenv/versions/3.6.13/envs/pyenv36/lib/python3.6/site-packages/setuptools/sandbox.py", line 45, in _execfile
exec(code, globals, locals)
File "/var/folders/zc/tjmjl2890y57f30n1yg7dg39xl_6k6/T/easy_install-zcqg452m/numpy-1.21.0rc2/setup.py", line 34, in <module>
_CYTHON_INSTALLED = ver >= LooseVersion(min_cython_ver)
RuntimeError: Python version >= 3.7 required.
The error is pretty explicit: Python version >= 3.7 required. According to the paths you’re using 3.6 (i.e. from 2016, and that will reach end-of-life at the end of the year).
This seems to come from the fact that pandas is trying to install numpy-1.21.0rc2 as a dependency, see the traceback (emphasis mine):
File "/var/folders/zc/tjmjl2890y57f30n1yg7dg39xl_6k6/T/easy_install-zcqg452m/numpy-1.21.0rc2/setup.py", line 34, in
I’m not sure why pandas is doing that, but if you first install the numpy from your requirements file, pandas might consider that dependency resolved.
pip install numpy==1.11.1
pip install -r requirements-remote.txt
By the way, neither numpy 1.11.1 nor pandas 0.18.1 list python 3.6 as a supported python version, they both have 3.5 at most. It might still work, but maybe it could also fail due to python 3.6 being too new (I have no way of testing this − sorry). You could try to refresh these dependencies to the highest versions that still support python 3.6:
numpy 1.19.5
pandas 1.1.5
getting up to speed on Anaconda, I keep receiving an error message when I try to import 'numpy' into Python.
Here is what I have done so far:
Downloaded anaconda from anaconda.com (64-Bit Graphical
Installer (466 MB) with Python 3.7 for Windows);
Installed anaconda (under C:\Users\'Username'\Anaconda3 | Option 'Register Anaconda3 as my default Python 3.7')
Now I'm trying to import numpy into Python using idle.exe, which produces following error message:
Warning: os.path.expanduser("~") points to
h:\,
but the path does not exist.
Futhermore, after executing "'import 'numpy;" in IDLE I get the following error message.
Unfortunately none of the advice was helpful. Numpy seems to be properly installed.
Warning (from warnings module): File "C:\Users\'Username'\Anaconda3\lib\site-
packages\numpy\__init__.py", line 140
from . import _distributor_init
UserWarning: mkl-service package failed to import, therefore Intel(R) MKL
initialization ensuring its correct out-of-the box operation under condition
when Gnu OpenMP had already been loaded by Python process is not assured.
Please install mkl-service package, see http://github.com/IntelPython/mkl-
service
Traceback (most recent call last):
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\core\__init__.py",
line 24, in <module>
from . import multiarray
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\core\multiarray.py",
line 14, in <module>
from . import overrides
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\core\overrides.py",
line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: DLL load failed: The specified module could not be found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\'Username'\Anaconda3\Scripts\myscripts\import_test.py", line 1,
in <module>
import numpy
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\__init__.py", line
142, in <module>
from . import core
File "C:\Users\'Username'\Anaconda3\lib\site-packages\numpy\core\__init__.py",
line 54, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy c-extensions failed.
- Try uninstalling and reinstalling numpy.
- If you have already done that, then:
1. Check that you expected to use Python3.7 from
"C:\Users\'Username'\Anaconda3\python.exe",
and that you have no directories in your PATH or PYTHONPATH that can
interfere with the Python and numpy version "1.18.1" you're trying to use.
2. If (1) looks fine, you can open a new issue at
https://github.com/numpy/numpy/issues. Please include details on:
- how you installed Python
- how you installed numpy
- your operating system
- whether or not you have multiple versions of Python installed
- if you built from source, your compiler versions and ideally a build log
- If you're working with a numpy git repository, try `git clean -xdf`
(removes all files not under version control) and rebuild numpy.
Note: this error has many possible causes, so please don't comment on
an existing issue about this - open a new one instead.
Original error was: DLL load failed: The specified module could not be found.
Many thanks in advance for any help and suggestions.
>>> import docx
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "c:\users\kevin\mu_code\docx\__init__.py", line 3, in <module>
from docx.api import Document # noqa
File "c:\users\kevin\mu_code\docx\api.py", line 14, in <module>
from docx.package import Package
File "c:\users\kevin\mu_code\docx\package.py", line 9, in <module>
from docx.opc.package import OpcPackage
File "c:\users\kevin\mu_code\docx\opc\package.py", line 9, in <module>
from docx.opc.part import PartFactory
File "c:\users\kevin\mu_code\docx\opc\part.py", line 12, in <module>
from .oxml import serialize_part_xml
File "c:\users\kevin\mu_code\docx\opc\oxml.py", line 12, in <module>
from lxml import etree
ImportError: cannot import name 'etree'
I have python-docx 0.8.10 and lxml 4.5.0, windows 10. I tried googling already but I'm not sure if I followed the suggestions correctly or if it's applicable in my case (lxml problems). I haven't had any problems installing other modules using "pip install" so I'm stuck and don't know how to proceed from here.
Check this,
Use pip install, to install the docx library and if you have already install it successfully then have a look into its dependencies. I think it is because of the incompatibility with its dependencies that is why you are getting the error.
pip install python-docx
Dependencies
Python 2.6, 2.7, 3.3, or 3.4
lxml >= 2.3.2
I don't know whether this may be an appropriate solution for you. But this is what I generally follow. Just install Anaconda in your system and an environment according to your needs. For your case create an environment for Python 3.4 using the following command
conda create --name py34 python=3.4
You then install libraries according to your needs in the respective environment. Now you can work into each environment without interfering with the libraries of the other environment. To use anaconda kindly follow Anaconda cheatsheet.
Kindly refer to the link. Hope this helps you.
This is almost certainly a problem with the lxml install. python-docx works with all versions of Python >= 2.6.
Instead of import docx, try from lxml import etree. If this produces the same error message, you know you've narrowed it down.
lxml depends on a couple of C libraries, lib2xml and libxslt if I remember correctly. These are sometimes tricky to install. In any case, you'll find solutions to those problems by searching on "lxml install windows" or similar.
Once from lxml import etree works without error I think you'll find import docx does too.
I read two or three questions related to this problem but I haven't found any solution yet. I don't understand why I have this error.
I am using Python 3.7 and installed scipyusing the pip installer and it worked properly. For those who want to know, I was testing this program (from this website).
If I go in my Python libraries I have two folders as shown on the image below
Now if I go to the scipy folder, I actually have a _lib folder as shown in the image below. So I don't really understand why this error raised up. And I don't know nor understand what I should do.
I don't have any file called integrate inside this folder, so either I am wrong about where to find the module or I have an obsolete scipy version which seems to be hard to know if you just use the pip installer.
The full error code is:
Traceback (most recent call last):
File "C:\Users\YANN\Desktop\Numerical Method - Python\odeint_example.py", line 2, in <module>
from scipy.integrate import odeint
File "C:\Users\YANN\AppData\Roaming\Python\Python37\site-packages\scipy\__init__.py", line 110, in <module>
from scipy._lib._version import NumpyVersion as _NumpyVersion
ModuleNotFoundError: No module named 'scipy._lib'
Also in the file scipy._lib._version.py the docstring of the NumpyVersion class is shown after and I am wondering if it's ok to have a numpy version 1.15.2? I like my 1.15.2 numpy version...
class NumpyVersion():
"""Parse and compare numpy version strings.
Numpy has the following versioning scheme (numbers given are examples; they
can be >9) in principle):
- Released version: '1.8.0', '1.8.1', etc.
- Alpha: '1.8.0a1', '1.8.0a2', etc.
- Beta: '1.8.0b1', '1.8.0b2', etc.
- Release candidates: '1.8.0rc1', '1.8.0rc2', etc.
- Development versions: '1.8.0.dev-f1234afa' (git commit hash appended)
- Development versions after a1: '1.8.0a1.dev-f1234afa',
'1.8.0b2.dev-f1234afa',
'1.8.1rc1.dev-f1234afa', etc.
- Development versions (no git hash available): '1.8.0.dev-Unknown'
Comparing needs to be done against a valid version string or other
`NumpyVersion` instance.
Parameters
----------
vstring : str
Numpy version string (``np.__version__``).
Notes
-----
All dev versions of the same (pre-)release compare equal.
Examples
--------
>>> from scipy._lib._version import NumpyVersion
>>> if NumpyVersion(np.__version__) < '1.7.0':
... print('skip')
skip
>>> NumpyVersion('1.7') # raises ValueError, add ".0"
"""
Any tips will be very appreciated! :)
I began with a pip install of "pywinauto" and attempted to import it, and I initially I got a message saying that the module win32api was missing. I attempted a pip install of that module but received a message saying that no satisfactory version could be found.
I then downloaded a copy of it from the web which when I tried to install it informed me that I don't have Python 3.6 installed on my system(!)
I had a number of installations of earlier versions and worried that they might be causing a problem so I deleted them and tried again, no success. The path to my executable is C:\Python36\python.exe.
I went to the site-packages folder and deleted the pywinauto and pywinauto-0.6.4-py3.6.egg-info folders and did a fresh pip install which concluded with the message: "Successfully installed pywinauto-0.6.4" and attempted to import it again.
This time I got the following:
import pywinauto
File "C:\Python36\lib\site-packages\pywinauto\__init__.py", line 72, in <module>
from . import findwindows
File "C:\Python36\lib\site-packages\pywinauto\findwindows.py", line 42, in <module>
from . import controls
File "C:\Python36\lib\site-packages\pywinauto\controls\__init__.py", line 36, in <module>
from . import uiawrapper # register "uia" back-end (at the end of uiawrapper module)
File "C:\Python36\lib\site-packages\pywinauto\controls\uiawrapper.py", line 46, in <module>
from ..uia_defines import IUIA
File "C:\Python36\lib\site-packages\pywinauto\uia_defines.py", line 181, in <module>
pattern_ids = _build_pattern_ids_dic()
File "C:\Python36\lib\site-packages\pywinauto\uia_defines.py", line 169, in _build_pattern_ids_dic
if hasattr(IUIA().ui_automation_client, cls_name):
File "C:\Python36\lib\site-packages\pywinauto\uia_defines.py", line 50, in __call__
cls._instances[cls] = super(_Singleton, cls).__call__(*args, **kwargs)
File "C:\Python36\lib\site-packages\pywinauto\uia_defines.py", line 63, in __init__
self.ui_automation_client.CUIAutomation().IPersist_GetClassID(),
AttributeError: module 'comtypes.gen.UIAutomationClient' has no attribute 'CUIAutomation'
At this point I really don't know what to do. It appears that one of the imported files is lacking something that another one needs. I would be grateful for any ideas......
The correct dependency can be installed so:
pip install pywin32
Previously it was pypiwin32 but something is changed in these packages maintenance and pywin32 became official again. pywinauto 0.6.5 will reflect these changes soon.
The second issue looks like known comtypes issue with generating cache files for UI Automation type library. The workaround assumes running the script as Administrator at least first time to have an access to comtypes cache folder. Unfortunately comtypes maintainers are not so active and there are a number of pull requests with very similar fixes and they all still hang unaccepted.