Skip to content

Wrong fallback version number when using PyInstaller #8200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
mancellin opened this issue Sep 18, 2023 · 3 comments
Closed

Wrong fallback version number when using PyInstaller #8200

mancellin opened this issue Sep 18, 2023 · 3 comments

Comments

@mancellin
Copy link
Contributor

mancellin commented Sep 18, 2023

What is your issue?

I'm trying to bundle some code using Xarray with PyInstaller.

As a MRE, consider the following file:

# test.py
import pandas as pd
import xarray as xr
print(xr.__version__)
pd.DataFrame({'a': range(10)}).to_xarray()

and the following command-line to build and run the Pyinstaller executable:

pyinstaller test.py && dist/test/test

Ideally, I would have expected the printed version to be 2023.8.0 (as when running the script without Pyinstaller).
The fallback 9999 from

__version__ = "9999"
would also have done the job.

Unfortunately, the actual version number is '999' which make the following pandas code to fail with:

Traceback (most recent call last):
  File "test.py", line 4, in <module>
    pd.DataFrame({'a': range(10)}).to_xarray()
  File "pandas/core/generic.py", line 3243, in to_xarray
  File "pandas/compat/_optional.py", line 161, in import_optional_dependency
ImportError: Pandas requires version '2022.03.0' or newer of 'xarray' (version '999' currently installed).

As a workaround, I added the line

xr.__version__ = "9999"

in my test.py file...

Versions
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.17 (main, Jul  5 2023, 20:41:20) 
[GCC 11.2.0]
python-bits: 64
OS: Linux
OS-release: 6.2.0-32-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: fr_FR.UTF-8
LOCALE: ('fr_FR', 'UTF-8')
libhdf5: None
libnetcdf: None

xarray: 2023.8.0
pandas: 2.1.0
numpy: 1.26.0
scipy: None
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: None
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 58.1.0
pip: 23.0.1
conda: None
pytest: None
mypy: None
IPython: None
sphinx: None
@mancellin mancellin added the needs triage Issue that has not been reviewed by xarray team member label Sep 18, 2023
@kmuehlbauer
Copy link
Contributor

@mancellin Thanks for the report! This was already fixed in #8181 and will be available in the next release.

@kmuehlbauer kmuehlbauer removed the needs triage Issue that has not been reviewed by xarray team member label Sep 18, 2023
@mancellin
Copy link
Contributor Author

Ah, of course, that's why my installed version was not behaving like the source on Github...
Thank you for your answer and sorry for the noise!

@kmuehlbauer
Copy link
Contributor

@mancellin No worries. Please do not hesitate to open issues in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants