junzis / pyModeS

Python decoder for Mode S and ADS-B signals
GNU General Public License v3.0
527 stars 151 forks source link

ModuleNotFoundError: No module named 'pyModeS.decoder.flarm.decode'` #155

Closed bsailer2510 closed 6 months ago

bsailer2510 commented 10 months ago

With the import of the package i run into a Module error.

OS: WIN11 Python: 3.11.4 pyModeS versions tested (same issue in all versions): 2.14, 2.15, 2.16 Packages installed via pip and requirements of

`--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) Cell In[6], line 1 ----> 1 from traffic.data import opensky 3 flight = opensky.history( 4 "2023-02-05 15:45", 5 stop="2023-02-05 16:45") 7 flight

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traffic\data__init.py:242, in getattr__(name) 240 if name == "opensky": 241 from . import session --> 242 from .adsb.opensky import OpenSky 244 # give priority to the OPENSKY_CACHE environment variable 245 opensky_cache = os.environ.get("OPENSKY_CACHE", None)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traffic\data\adsb\opensky.py:29 27 from ...core.time import round_time, timelike, to_datetime 28 from ..basic.airports import Airport ---> 29 from .opensky_impala import Impala 31 if TYPE_CHECKING: 32 from cartopy.mpl.geoaxes import GeoAxesSubplot

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traffic\data\adsb\opensky_impala.py:27 25 from ...core.time import round_time, split_times, timelike, to_datetime 26 from ...core.types import ProgressbarType ---> 27 from .flarm_data import FlarmData 28 from .raw_data import RawData 30 _log = logging.getLogger(name)

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\traffic\data\adsb\flarm_data.py:3 1 from typing import Iterable, Optional, Type, TypeVar ----> 3 from pyModeS.decoder.flarm import DecodedMessage, flarm 4 from tqdm.rich import tqdm 5 from typing_extensions import Annotated

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\pyModeS\decoder\flarm__init__.py:3 1 from typing import TypedDict ----> 3 from .decode import flarm as flarm_decode 5 all = ["DecodedMessage", "flarm"] 8 class DecodedMessage(TypedDict):

ModuleNotFoundError: No module named 'pyModeS.decoder.flarm.decode'`

xoolive commented 10 months ago

I don't have a Windows at hand, but just for debugging purposes, could you try the following? (I would like to check whether you have an error)

from pyModeS import c_common
xoolive commented 10 months ago

If this fails, please try to reinstall that way:

pip uninstall pymodes
pip install -U pymodes --no-binary pymodes

Then try again the import. If this works (only), please tell me the result of the following command:

from pathlib import Path
import pyModes
list(Path(pyModeS.__path__[0]).glob("**/flarm/decode*"))
bsailer2510 commented 10 months ago

I don't have a Windows at hand, but just for debugging purposes, could you try the following? (I would like to check whether you have an error)

from pyModeS import c_common

Output: >>> from pyModeS import c_common Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: cannot import name 'c_common' from 'pyModeS' (C:\Users\bernh\anaconda3\Lib\site-packages\pyModeS\__init__.py)

bsailer2510 commented 10 months ago

After deinstallation and with

pip install -U pymodes --no-binary pymodes

it runs into

`(base) PS C:\Users\bernh> pip install -U pymodes --no-binary pymodes Collecting pymodes Using cached pymodes-2.16.tar.gz (63 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: numpy<2.0,>=1.24 in c:\users\bernh\anaconda3\lib\site-packages (from pymodes) (1.24.3) Requirement already satisfied: pyzmq<25.0,>=24.0 in c:\users\bernh\anaconda3\lib\site-packages (from pymodes) (24.0.1) Building wheels for collected packages: pymodes Building wheel for pymodes (pyproject.toml) ... error error: subprocess-exited-with-error

× Building wheel for pymodes (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [51 lines of output] C:\Users\bernh\AppData\Local\Temp\pip-install-3wffpngh\pymodes_e1ada962e3ac412ea614ece9dbf63481\build.py:4: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives from distutils.command import build_ext Compiling pyModeS/c_common.pyx because it changed. Compiling pyModeS/decoder/flarm/decode.pyx because it changed. [1/2] Cythonizing pyModeS/c_common.pyx [2/2] Cythonizing pyModeS/decoder/flarm/decode.pyx Traceback (most recent call last): File "C:\Users\bernh\AppData\Local\Temp\pip-install-3wffpngh\pymodes_e1ada962e3ac412ea614ece9dbf63481\build.py", line 69, in build() File "C:\Users\bernh\AppData\Local\Temp\pip-install-3wffpngh\pymodes_e1ada962e3ac412ea614ece9dbf63481\build.py", line 57, in build cmd.run() File "C:\Users\bernh\anaconda3\Lib\distutils\command\build_ext.py", line 340, in run self.build_extensions() File "C:\Users\bernh\anaconda3\Lib\distutils\command\build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "C:\Users\bernh\anaconda3\Lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial self.build_extension(ext) File "C:\Users\bernh\anaconda3\Lib\distutils\command\build_ext.py", line 529, in build_extension objects = self.compiler.compile(sources, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\bernh\anaconda3\Lib\distutils_msvccompiler.py", line 323, in compile self.initialize() File "C:\Users\bernh\anaconda3\Lib\distutils_msvccompiler.py", line 220, in initialize vc_env = _get_vc_env(plat_spec) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\bernh\anaconda3\Lib\distutils_msvccompiler.py", line 122, in _get_vc_env raise DistutilsPlatformError("Unable to find vcvarsall.bat") distutils.errors.DistutilsPlatformError: Unable to find vcvarsall.bat Traceback (most recent call last): File "C:\Users\bernh\anaconda3\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 353, in main() File "C:\Users\bernh\anaconda3\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\bernh\anaconda3\Lib\site-packages\pip_vendor\pyproject_hooks_in_process_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\bernh\AppData\Local\Temp\pip-build-env-fy1dtu77\overlay\Lib\site-packages\poetry\core\masonry\api.py", line 57, in build_wheel return WheelBuilder.make_in( ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\bernh\AppData\Local\Temp\pip-build-env-fy1dtu77\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 88, in make_in wb.build(target_dir=directory) File "C:\Users\bernh\AppData\Local\Temp\pip-build-env-fy1dtu77\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 123, in build self._build(zip_file) File "C:\Users\bernh\AppData\Local\Temp\pip-build-env-fy1dtu77\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 172, in _build self._run_build_script(self._package.build_script) File "C:\Users\bernh\AppData\Local\Temp\pip-build-env-fy1dtu77\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 232, in _run_build_script subprocess.check_call([self.executable.as_posix(), build_script]) File "C:\Users\bernh\anaconda3\Lib\subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['C:/Users/bernh/anaconda3/python.exe', 'build.py']' returned non-zero exit status 1. [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pymodes Failed to build pymodes ERROR: Could not build wheels for pymodes, which is required to install pyproject.toml-based projects`

With reference to a specific version the installation works. Pip lists installed version 2.16 now but,....

`>>> import pymodes Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'pymodes'

from pyModeS import c_common Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'c_common' from 'pyModeS' (C:\Users\bernh\anaconda3\Lib\site-packages\pyModeS__init__.py) `

A reboot didn't help. Tried it in Jupyter, Command prompt and Anachonda environment. Output is everywhere the same.

bsailer2510 commented 10 months ago

There' also an issue with the installation in Colab:

https://colab.research.google.com/drive/1E7rFCFMPLKDF_PU91DQXcCdSk0XPcVqI?usp=sharing

xoolive commented 10 months ago

Please try pyModeS v2.17 (couldn't try myself, crossing fingers...)