ImportError: cannot import name 'Zippy' from 'zippy.zippy' (/kaggle/working/zippy/zippy/__init__.py)
FriedaSmith opened this issue · comments
Describe the bug
- Install zippy in kaggle using the following command.
!pip install --upgrade numpy==1.25.2
!python3 -c "import numpy as np; print('> NumPy version: {}'.format(np.__version__))"
!git clone https://github.com/thinkst/zippy.git && cd zippy && pip install -r requirements.txt &&python3 setup.py build && python3 setup.py install
The output information is as follows:
Collecting numpy==1.25.2
Downloading numpy-1.25.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.2/18.2 MB 45.7 MB/s eta 0:00:0000:0100:01
Installing collected packages: numpy
Attempting uninstall: numpy
Found existing installation: numpy 1.23.5
Uninstalling numpy-1.23.5:
Successfully uninstalled numpy-1.23.5
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
apache-beam 2.46.0 requires dill<0.3.2,>=0.3.1.1, but you have dill 0.3.7 which is incompatible.
apache-beam 2.46.0 requires numpy<1.25.0,>=1.14.3, but you have numpy 1.25.2 which is incompatible.
momepy 0.6.0 requires shapely>=2, but you have shapely 1.8.5.post1 which is incompatible.
numba 0.57.1 requires numpy<1.25,>=1.21, but you have numpy 1.25.2 which is incompatible.
pymc3 3.11.5 requires numpy<1.22.2,>=1.15.0, but you have numpy 1.25.2 which is incompatible.
pymc3 3.11.5 requires scipy<1.8.0,>=1.7.3, but you have scipy 1.11.2 which is incompatible.
tensorflow 2.12.0 requires numpy<1.24,>=1.22, but you have numpy 1.25.2 which is incompatible.
woodwork 0.26.0 requires numpy<1.25.0,>=1.22.0, but you have numpy 1.25.2 which is incompatible.
ydata-profiling 4.3.1 requires numpy<1.24,>=1.16.0, but you have numpy 1.25.2 which is incompatible.
ydata-profiling 4.3.1 requires scipy<1.11,>=1.4.1, but you have scipy 1.11.2 which is incompatible.
Successfully installed numpy-1.25.2
> NumPy version: 1.25.2
Cloning into 'zippy'...
remote: Enumerating objects: 829, done.
remote: Counting objects: 100% (222/222), done.
remote: Compressing objects: 100% (135/135), done.
remote: Total 829 (delta 130), reused 152 (delta 82), pack-reused 607
Receiving objects: 100% (829/829), 46.75 MiB | 25.33 MiB/s, done.
Resolving deltas: 100% (343/343), done.
Updating files: 100% (319/319), done.
Requirement already satisfied: numpy in /opt/conda/lib/python3.10/site-packages (from -r requirements.txt (line 2)) (1.25.2)
Collecting brotli (from -r requirements.txt (line 4))
Downloading Brotli-1.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (3.0 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.0/3.0 MB 29.0 MB/s eta 0:00:00a 0:00:01
Installing collected packages: brotli
Successfully installed brotli-1.1.0
/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` directly.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
********************************************************************************
!!
self.initialize_options()
/opt/conda/lib/python3.10/site-packages/setuptools/_distutils/cmd.py:66: EasyInstallDeprecationWarning: easy_install command is deprecated.
!!
********************************************************************************
Please avoid running ``setup.py`` and ``easy_install``.
Instead, use pypa/build, pypa/installer or other
standards-based tools.
See https://github.com/pypa/setuptools/issues/917 for details.
********************************************************************************
!!
self.initialize_options()
- I can use the following command to work properly
import zippy.zippy
- However, running the following command,
from zippy.zippy import Zippy, EnsembledZippy, PRELUDE_STR, LzmaLlmDetector, BrotliLlmDetector, ZlibLlmDetector, CompressionEngine
The error message is as follows:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[4], line 1
----> 1 from zippy.zippy import Zippy, EnsembledZippy, PRELUDE_STR, LzmaLlmDetector, BrotliLlmDetector, ZlibLlmDetector, CompressionEngine
ImportError: cannot import name 'Zippy' from 'zippy.zippy' (/kaggle/working/zippy/zippy/__init__.py)
- System version in kaggle
!uname -a
Linux eb546a198970 5.15.133+ #1 SMP Sat Nov 4 11:53:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
Thanks for this, I'll try to reproduce and fix today
Good catch @FriedaSmith, and thanks for reporting. I believe this is now fixed in HEAD. On a clean notebook and new runtime:
!pip install --upgrade numpy==1.25.2
!git clone https://github.com/thinkst/zippy.git && cd zippy && pip install -r requirements.txt && python3 setup.py build && python3 setup.py sdist
!pip3 install ./zippy/dist/ZipPy\ setup\ file-0.1.1.tar.gz
Will install the package and the command-line utility. Now you can import directly from the package:
from zippy import Zippy
z = Zippy()
!zippy -h
usage: zippy [-h] [-p P] [-e {zlib,lzma,brotli,ensemble}] [-s | sample_files ...]
positional arguments:
sample_files Text file(s) containing the sample to classify
options:
-h, --help show this help message and exit
-p P Preset to use with compressor, higher values are slower but provide better
compression
-e {zlib,lzma,brotli,ensemble}
Which compression engine to use: lzma, zlib, brotli, or an ensemble of all
engines
-s Read from stdin until EOF is reached instead of from a file
I'm going to mark this as closed, please re-open if it's not working for you still.