yoeo / guesslang

Detect the programming language of a source code
https://guesslang.readthedocs.io
MIT License
798 stars 114 forks source link

pkg_resources.DistributionNotFound: The 'tensorflow==2.5.0' distribution was not found and is required by guesslang #65

Open carlosal1015 opened 2 years ago

carlosal1015 commented 2 years ago

Hi, with latest python-tensorflow 2.9.1 upgrade, guesslang stop working.

Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 573, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 891, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 782, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (tensorflow 2.9.1 (/usr/lib/python3.10/site-packages), Requirement.parse('tensorflow==2.5.0'), {'guesslang'})

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/sbin/guesslang", line 33, in <module>
    sys.exit(load_entry_point('guesslang==2.2.1', 'console_scripts', 'guesslang')())
  File "/usr/sbin/guesslang", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 992, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/guesslang/__init__.py", line 16, in <module>
    from guesslang.guess import Guess, GuesslangError  # noqa: F401
  File "/usr/lib/python3.10/site-packages/guesslang/guess.py", line 10, in <module>
    from guesslang import model
  File "/usr/lib/python3.10/site-packages/guesslang/model.py", line 11, in <module>
    import tensorflow as tf
  File "/usr/lib/python3.10/site-packages/tensorflow/__init__.py", line 37, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "/usr/lib/python3.10/site-packages/tensorflow/python/__init__.py", line 45, in <module>
    from tensorflow.python.feature_column import feature_column_lib as feature_column
  File "/usr/lib/python3.10/site-packages/tensorflow/python/feature_column/feature_column_lib.py", line 18, in <module>
    from tensorflow.python.feature_column.feature_column import *
  File "/usr/lib/python3.10/site-packages/tensorflow/python/feature_column/feature_column.py", line 143, in <module>
    from tensorflow.python.layers import base
  File "/usr/lib/python3.10/site-packages/tensorflow/python/layers/base.py", line 16, in <module>
    from tensorflow.python.keras.legacy_tf_layers import base
  File "/usr/lib/python3.10/site-packages/tensorflow/python/keras/__init__.py", line 25, in <module>
    from tensorflow.python.keras import models
  File "/usr/lib/python3.10/site-packages/tensorflow/python/keras/models.py", line 20, in <module>
    from tensorflow.python.keras import metrics as metrics_module
  File "/usr/lib/python3.10/site-packages/tensorflow/python/keras/metrics.py", line 34, in <module>
    from tensorflow.python.keras import activations
  File "/usr/lib/python3.10/site-packages/tensorflow/python/keras/activations.py", line 18, in <module>
    from tensorflow.python.keras.layers import advanced_activations
  File "/usr/lib/python3.10/site-packages/tensorflow/python/keras/layers/__init__.py", line 68, in <module>
    from tensorflow.python.keras.layers.core import Masking
  File "/usr/lib/python3.10/site-packages/tensorflow/python/keras/layers/core.py", line 54, in <module>
    from tensorflow.python.ops import standard_ops
  File "/usr/lib/python3.10/site-packages/tensorflow/python/ops/standard_ops.py", line 108, in <module>
    from tensorflow.python.compiler.tensorrt import trt_convert as trt
  File "/usr/lib/python3.10/site-packages/tensorflow/python/compiler/tensorrt/__init__.py", line 18, in <module>
    from tensorflow.python.compiler.tensorrt import trt_convert as trt
  File "/usr/lib/python3.10/site-packages/tensorflow/python/compiler/tensorrt/trt_convert.py", line 30, in <module>
    from tensorflow.python.compiler.tensorrt import utils as trt_utils
  File "/usr/lib/python3.10/site-packages/tensorflow/python/compiler/tensorrt/utils.py", line 17, in <module>
    from distutils import version
  File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 16, in <module>
    import setuptools.version
  File "/usr/lib/python3.10/site-packages/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3317, in <module>
    def _initialize_master_working_set():
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3291, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 3329, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 575, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 588, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/lib/python3.10/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'tensorflow==2.5.0' distribution was not found and is required by guesslang
carlosal1015 commented 2 years ago

With python-tensorflow-2.9.2-1 we have the following message error.

==> Retrieving sources...
  -> Downloading v2.2.1.tar.gz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 4256k    0 4256k    0     0  8329k      0 --:--:-- --:--:-- --:--:-- 8329k
==> Validating source files with sha512sums...
    v2.2.1.tar.gz ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Extracting v2.2.1.tar.gz with bsdtar
==> Starting build()...
running build
running build_py
creating build
creating build/lib
creating build/lib/guesslang
copying guesslang/guess.py -> build/lib/guesslang
copying guesslang/__init__.py -> build/lib/guesslang
copying guesslang/__main__.py -> build/lib/guesslang
copying guesslang/model.py -> build/lib/guesslang
running egg_info
creating guesslang.egg-info
writing guesslang.egg-info/PKG-INFO
writing dependency_links to guesslang.egg-info/dependency_links.txt
writing entry points to guesslang.egg-info/entry_points.txt
writing requirements to guesslang.egg-info/requires.txt
writing top-level names to guesslang.egg-info/top_level.txt
writing manifest file 'guesslang.egg-info/SOURCES.txt'
reading manifest file 'guesslang.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'guesslang.egg-info/SOURCES.txt'
/usr/lib/python3.10/site-packages/setuptools/command/build_py.py:153: SetuptoolsDeprecationWarning:     Installing 'guesslang.data' as data is deprecated, please list it in `packages`.
    !!
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'guesslang.data' as an importable package,
    but it is not listed in the `packages` configuration of setuptools.
    'guesslang.data' has been automatically added to the distribution only
    because it may contain data files, but this behavior is likely to change
    in future versions of setuptools (and therefore is considered deprecated).
    Please make sure that 'guesslang.data' is included as a package by using
    the `packages` configuration field or the proper discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).
    You can read more about "package discovery" and "data files" on setuptools
    documentation page.
!!
  check.warn(importable)
/usr/lib/python3.10/site-packages/setuptools/command/build_py.py:153: SetuptoolsDeprecationWarning:     Installing 'guesslang.data.model' as data is deprecated, please list it in `packages`.
    !!
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'guesslang.data.model' as an importable package,
    but it is not listed in the `packages` configuration of setuptools.
    'guesslang.data.model' has been automatically added to the distribution only
    because it may contain data files, but this behavior is likely to change
    in future versions of setuptools (and therefore is considered deprecated).
    Please make sure that 'guesslang.data.model' is included as a package by using
    the `packages` configuration field or the proper discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).
    You can read more about "package discovery" and "data files" on setuptools
    documentation page.
!!
  check.warn(importable)
/usr/lib/python3.10/site-packages/setuptools/command/build_py.py:153: SetuptoolsDeprecationWarning:     Installing 'guesslang.data.model.variables' as data is deprecated, please list it in `packages`.
    !!
    ############################
    # Package would be ignored #
    ############################
    Python recognizes 'guesslang.data.model.variables' as an importable package,
    but it is not listed in the `packages` configuration of setuptools.
    'guesslang.data.model.variables' has been automatically added to the distribution only
    because it may contain data files, but this behavior is likely to change
    in future versions of setuptools (and therefore is considered deprecated).
    Please make sure that 'guesslang.data.model.variables' is included as a package by using
    the `packages` configuration field or the proper discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).
    You can read more about "package discovery" and "data files" on setuptools
    documentation page.
!!
  check.warn(importable)
creating build/lib/guesslang/data
copying guesslang/data/languages.json -> build/lib/guesslang/data
creating build/lib/guesslang/data/model
copying guesslang/data/model/saved_model.pb -> build/lib/guesslang/data/model
creating build/lib/guesslang/data/model/variables
copying guesslang/data/model/variables/variables.data-00000-of-00001 -> build/lib/guesslang/data/model/variables
copying guesslang/data/model/variables/variables.index -> build/lib/guesslang/data/model/variables
==> Starting check()...
============================= test session starts ==============================
platform linux -- Python 3.10.6, pytest-7.1.3, pluggy-1.0.0
rootdir: /tmp/makepkg/guesslang/src/guesslang-2.2.1
collected 0 items / 1 error
==================================== ERRORS ====================================
________________ ERROR collecting tests/test_guesslang_guess.py ________________
ImportError while importing test module '/tmp/makepkg/guesslang/src/guesslang-2.2.1/tests/test_guesslang_guess.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_guesslang_guess.py:6: in <module>
    from guesslang import Guess, GuesslangError
guesslang/__init__.py:16: in <module>
    from guesslang.guess import Guess, GuesslangError  # noqa: F401
guesslang/guess.py:10: in <module>
    from guesslang import model
guesslang/model.py:12: in <module>
    from tensorflow.estimator import ModeKeys, Estimator
/usr/lib/python3.10/site-packages/tensorflow_estimator/python/estimator/api/_v2/estimator/__init__.py:8: in <module>
    from tensorflow_estimator.python.estimator.api._v2.estimator import experimental
/usr/lib/python3.10/site-packages/tensorflow_estimator/__init__.py:8: in <module>
    from tensorflow_estimator._api.v1 import estimator
/usr/lib/python3.10/site-packages/tensorflow_estimator/_api/v1/estimator/__init__.py:8: in <module>
    from tensorflow_estimator._api.v1.estimator import experimental
/usr/lib/python3.10/site-packages/tensorflow_estimator/_api/v1/estimator/experimental/__init__.py:8: in <module>
    from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
/usr/lib/python3.10/site-packages/tensorflow_estimator/python/estimator/canned/dnn.py:29: in <module>
    from tensorflow_estimator.python.estimator.canned import optimizers
/usr/lib/python3.10/site-packages/tensorflow_estimator/python/estimator/canned/optimizers.py:34: in <module>
    'Adagrad': tf.keras.optimizers.Adagrad,
/usr/lib/python3.10/site-packages/tensorflow/python/util/lazy_loader.py:58: in __getattr__
    module = self._load()
/usr/lib/python3.10/site-packages/tensorflow/python/util/lazy_loader.py:41: in _load
    module = importlib.import_module(self.__name__)
/usr/lib/python3.10/importlib/__init__.py:126: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
/usr/lib/python3.10/site-packages/keras/__init__.py:21: in <module>
    from keras import models
/usr/lib/python3.10/site-packages/keras/models/__init__.py:18: in <module>
    from keras.engine.functional import Functional
/usr/lib/python3.10/site-packages/keras/engine/functional.py:27: in <module>
    from keras.dtensor import layout_map as layout_map_lib
/usr/lib/python3.10/site-packages/keras/dtensor/layout_map.py:25: in <module>
    from keras.dtensor import lazy_variable
/usr/lib/python3.10/site-packages/keras/dtensor/lazy_variable.py:26: in <module>
    from tensorflow.python.trackable import base as trackable
E   ModuleNotFoundError: No module named 'tensorflow.python.trackable'
=========================== short test summary info ============================
ERROR tests/test_guesslang_guess.py
!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!
=============================== 1 error in 2.44s ===============================
==> ERROR: A failure occurred in check().
    Aborting...