opentensor / bittensor

Internet-scale Neural Networks
https://www.bittensor.com/
MIT License
934 stars 323 forks source link

Erroneous `pkg_resources` deprecation warning on `btcli` commands #1487

Closed satoshitty closed 1 year ago

satoshitty commented 1 year ago

Describe the bug

Attempting to run btcli commands can sometimes result in a deprecation warning for pkg_resources but is actually erroneous.

The problem is with pip when installing bittensor from source, which uses an incorrect codepath for running editable installs.

See: https://github.com/pypa/setuptools/issues/3981#issuecomment-1636033147

To Reproduce

E.g. if you install bittensor like so:

cd bittensor
python -m pip install -e .

You'll get:

$btcli overview
~/bin/btcli:4: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  __import__('pkg_resources').require('bittensor==6.0.0')
Enter wallet name (default): 

Expected behavior

There should be no deprecation warning.

Screenshots

No response

Environment

Linux

Additional context

No response

ifrit98 commented 1 year ago

This should solve it:

When installing bittensor with editable installs use: --use-pep517.

e.g. when inside the main repo directory bittensor:

python -m pip install -e . --use-pep517