Search code examples
pythonpython-3.xpyinstaller

getting the error "packaging.version.InvalidVersion: Invalid version: 'None'" while executing the exe created by pyinstaller in linux


Using the following csv file csv file

import datetime
import pandas as pd
import numpy as np
# import xarray as xr


import holoviews as hv
import colorcet as cc

df = pd.read_csv('./grant.csv')
print(df.head())
df_2012 = df.loc[df['year']==2012, :].copy()

hv.Points(
    data=df_2012,
    kdims=['beak length (mm)', 'beak depth (mm)'],
    vdims=['species'],
)

after using the following command for creating the exe , I could able to get the exe file inside

pyinstaller grant.py

ls dist/grant/grant

while running the this exe ./grant I am getting the following error

Traceback (most recent call last):
  File "grant.py", line 7, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/__init__.py", line 11, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/util/__init__.py", line 15, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/core/__init__.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/core/boundingregion.py", line 12, in <module>
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 495, in exec_module
  File "holoviews/core/util.py", line 53, in <module>
  File "packaging/version.py", line 266, in __init__
packaging.version.InvalidVersion: Invalid version: 'None'
[1396395] Failed to execute script 'grant' due to unhandled exception!

Please help on this .


Solution

  • It appears that you need to use the --collect-all flag on the package param inside of your pyinstaller command.

    for example:

    pyinstaller -F --collect-all param grant.py
    

    Or you can leave out the -F if you don't want it compiled to a single file.