HydraChain / hydrachain

Permissioned Distributed Ledger based on Ethereum
MIT License
358 stars 105 forks source link

Version "undefined" after install via PIP #60

Open heikoheiko opened 8 years ago

heikoheiko commented 8 years ago

After an install with pip install hydrachain on a fresh env on Linux hostname 3.13.0-32-generic #57-Ubuntu

(newer)heiko@TTVM148:~$ hydrachain 
Usage: hydrachain [OPTIONS] COMMAND [ARGS]...

  Welcome to HydraChain/vundefined/linux2/py2.7.6

Expected: Version number reported

Experienced: 'undefined' was reported

(newer)heiko@TTVM148:~$ pip show hydrachain

---
Metadata-Version: 2.0
Name: hydrachain
Version: 0.3.0
konradkonrad commented 8 years ago

Could not reproduce. Installing in clean venv results in HydraChain/v0.3.0/linux2/py2.7.10 for me.

Please report:

which hydrachain
python -c "import hydrachain; print hydrachain.__file__"

My assumption: your pypi/pip install is shadowed by a local installation..?

ulope commented 8 years ago

Can't reproduce it either.

The only way I can think of this could happen is if the code is run from a source tarball (not a git checkout) without running pip install -e . first.

schmir commented 8 years ago

I'm observing the same problem after upgrading hydrachain:

(local) ~ % hydrachain
Usage: hydrachain [OPTIONS] COMMAND [ARGS]...

  Welcome to HydraChain/v0.1.17/linux2/py2.7.9

Options:
  --profile [morden|frontier]  Configuration profile.  [default: morden]
  -C, --Config TEXT            Alternative config file
  -c TEXT                      Single configuration parameters
                   (<param>=<value>)
  -d, --data-dir TEXT          data directory  [default:
                   /home/ralf/.config/pyethapp]
  -l, --log_config TEXT        log_config string: e.g. ":info,eth:debug
                   [default: :info]
  --log-json / --log-no-json   log as structured json output
  --log-file PATH              Log to file instead of stderr.
  -b, --bootstrap_node TEXT    single bootstrap_node as
                   enode://pubkey@host:port
  -m, --mining_pct INTEGER     pct cpu used for mining
  --unlock TEXT                Unlock an account (prompts for password)
  --password FILENAME          path to a password file
  --help                       Show this message and exit.

Commands:
  account      Manage accounts.
  blocktest    Start after importing blocks from a file.
  config       Show the config
  export       Export the blockchain to FILE.
  import       Import blocks from FILE.
  run          Start the client ( --dev to stop on error)
  rundummy     run in a zero config default configuration
  runlocal     run in a zero config default configuration
  runmultiple  run multiple nodes in a zero config default...
(local) ~ % pip install -U hydrachain
Collecting hydrachain
  Downloading hydrachain-0.3.0-py2.py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 126kB/s
Requirement already up-to-date: simpy in ./local/lib/python2.7/site-packages (from hydrachain)
Requirement already up-to-date: rlp>=0.4.3 in ./local/lib/python2.7/site-packages (from hydrachain)
Requirement already up-to-date: c-secp256k1==0.0.8 in ./local/lib/python2.7/site-packages (from hydrachain)
Requirement already up-to-date: serpent in ./local/lib/python2.7/site-packages (from hydrachain)
Requirement already up-to-date: pytest==2.8.2 in ./local/lib/python2.7/site-packages (from hydrachain)
Collecting pyethapp>=1.0.11 (from hydrachain)
  Downloading pyethapp-1.2.1-py2.py3-none-any.whl (331kB)
    100% |████████████████████████████████| 337kB 136kB/s
Requirement already up-to-date: bitcoin==1.1.39 in ./local/lib/python2.7/site-packages (from hydrachain)
Collecting cffi>=1.2.1 (from c-secp256k1==0.0.8->hydrachain)
  Downloading cffi-1.6.0.tar.gz (397kB)
    100% |████████████████████████████████| 399kB 134kB/s
Requirement already up-to-date: py>=1.4.29 in ./local/lib/python2.7/site-packages (from pytest==2.8.2->hydrachain)
Requirement already up-to-date: gipc==0.4.0 in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: pbkdf2 in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: wheel in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Collecting ethereum>=1.2.0 (from pyethapp>=1.0.11->hydrachain)
  Downloading ethereum-1.3.0.tar.gz (112kB)
    100% |████████████████████████████████| 122kB 134kB/s
Collecting requests (from pyethapp>=1.0.11->hydrachain)
  Downloading requests-2.10.0-py2.py3-none-any.whl (506kB)
    100% |████████████████████████████████| 512kB 135kB/s
Collecting werkzeug (from pyethapp>=1.0.11->hydrachain)
  Downloading Werkzeug-0.11.9-py2.py3-none-any.whl (306kB)
    100% |████████████████████████████████| 307kB 991kB/s
Collecting ipython>=3.0.0 (from pyethapp>=1.0.11->hydrachain)
  Downloading ipython-4.2.0-py2-none-any.whl (736kB)
    100% |████████████████████████████████| 737kB 113kB/s
Requirement already up-to-date: CodernityDB in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: statistics in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Collecting gevent==1.1.0 (from pyethapp>=1.0.11->hydrachain)
  Downloading gevent-1.1.0-cp27-cp27mu-manylinux1_x86_64.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 715kB/s
Requirement already up-to-date: leveldb in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: scrypt in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: decorator in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Collecting click (from pyethapp>=1.0.11->hydrachain)
  Downloading click-6.6.tar.gz (283kB)
    100% |████████████████████████████████| 286kB 136kB/s
Collecting lmdb (from pyethapp>=1.0.11->hydrachain)
  Downloading lmdb-0.89.tar.gz (149kB)
    100% |████████████████████████████████| 153kB 144kB/s
Collecting devp2p>=0.7.2 (from pyethapp>=1.0.11->hydrachain)
  Downloading devp2p-0.7.2-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 137kB/s
Requirement already up-to-date: pyyaml in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: pexpect in ./local/lib/python2.7/site-packages (from pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: pycparser in ./local/lib/python2.7/site-packages (from cffi>=1.2.1->c-secp256k1==0.0.8->hydrachain)
Requirement already up-to-date: repoze.lru in ./local/lib/python2.7/site-packages (from ethereum>=1.2.0->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: pysha3 in ./local/lib/python2.7/site-packages (from ethereum>=1.2.0->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: pycryptodome>=3.3.1 in ./local/lib/python2.7/site-packages (from ethereum>=1.2.0->pyethapp>=1.0.11->hydrachain)
Collecting secp256k1 (from ethereum>=1.2.0->pyethapp>=1.0.11->hydrachain)
  Downloading secp256k1-0.12.1.tar.gz (144kB)
    100% |████████████████████████████████| 153kB 152kB/s
Requirement already up-to-date: pyethash in ./local/lib/python2.7/site-packages (from ethereum>=1.2.0->pyethapp>=1.0.11->hydrachain)
Collecting traitlets (from ipython>=3.0.0->pyethapp>=1.0.11->hydrachain)
  Downloading traitlets-4.2.1-py2.py3-none-any.whl (67kB)
    100% |████████████████████████████████| 71kB 132kB/s
Collecting pickleshare (from ipython>=3.0.0->pyethapp>=1.0.11->hydrachain)
  Downloading pickleshare-0.7.2-py2.py3-none-any.whl
Requirement already up-to-date: simplegeneric>0.8 in ./local/lib/python2.7/site-packages (from ipython>=3.0.0->pyethapp>=1.0.11->hydrachain)
Collecting backports.shutil-get-terminal-size (from ipython>=3.0.0->pyethapp>=1.0.11->hydrachain)
  Downloading backports.shutil_get_terminal_size-1.0.0-py2.py3-none-any.whl
Requirement already up-to-date: setuptools>=18.5 in ./local/lib/python2.7/site-packages (from ipython>=3.0.0->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: docutils>=0.3 in ./local/lib/python2.7/site-packages (from statistics->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: greenlet>=0.4.9 in ./local/lib/python2.7/site-packages (from gevent==1.1.0->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: coverage in ./local/lib/python2.7/site-packages (from devp2p>=0.7.2->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: ipaddress in ./local/lib/python2.7/site-packages (from devp2p>=0.7.2->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: pyelliptic in ./local/lib/python2.7/site-packages (from devp2p>=0.7.2->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: tinyrpc in ./local/lib/python2.7/site-packages (from devp2p>=0.7.2->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: tox in ./local/lib/python2.7/site-packages (from devp2p>=0.7.2->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: ptyprocess>=0.5 in ./local/lib/python2.7/site-packages (from pexpect->pyethapp>=1.0.11->hydrachain)
Requirement already up-to-date: ipython-genutils in ./local/lib/python2.7/site-packages (from traitlets->ipython>=3.0.0->pyethapp>=1.0.11->hydrachain)
Collecting pathlib2 (from pickleshare->ipython>=3.0.0->pyethapp>=1.0.11->hydrachain)
  Downloading pathlib2-2.1.0-py2.py3-none-any.whl
Collecting virtualenv>=1.11.2 (from tox->devp2p>=0.7.2->pyethapp>=1.0.11->hydrachain)
  Downloading virtualenv-15.0.1-py2.py3-none-any.whl (1.8MB)
    100% |████████████████████████████████| 1.8MB 104kB/s
Requirement already up-to-date: pluggy<0.4.0,>=0.3.0 in ./local/lib/python2.7/site-packages (from tox->devp2p>=0.7.2->pyethapp>=1.0.11->hydrachain)
Collecting six (from pathlib2->pickleshare->ipython>=3.0.0->pyethapp>=1.0.11->hydrachain)
  Downloading six-1.10.0-py2.py3-none-any.whl
Building wheels for collected packages: cffi, ethereum, click, lmdb, secp256k1
  Running setup.py bdist_wheel for cffi ... done
  Stored in directory: /home/ralf/.cache/pip/wheels/8f/00/29/553c1b1db38bbeec3fec428ae4e400cd8349ecd99fe86edea1
  Running setup.py bdist_wheel for ethereum ... done
  Stored in directory: /home/ralf/.cache/pip/wheels/3c/07/96/66241dea8da79ed9aeb8936e802a1322ca1547f231e3aae911
  Running setup.py bdist_wheel for click ... done
  Stored in directory: /home/ralf/.cache/pip/wheels/b0/6d/8c/cf5ca1146e48bc7914748bfb1dbf3a40a440b8b4f4f0d952dd
  Running setup.py bdist_wheel for lmdb ... done
  Stored in directory: /home/ralf/.cache/pip/wheels/1d/36/58/b211fed809590977150eabf644580f7bc23569d1d782275fd6
  Running setup.py bdist_wheel for secp256k1 ... done
  Stored in directory: /home/ralf/.cache/pip/wheels/f9/d4/2e/45de9a2b74244b2453aebcef57db807fba5f51f9f4ed63ce07
Successfully built cffi ethereum click lmdb secp256k1
Installing collected packages: cffi, secp256k1, ethereum, requests, werkzeug, traitlets, six, pathlib2, pickleshare, backports.shutil-get-terminal-size, ipython, gevent, click, lmdb, devp2p, pyethapp, hydrachain, virtualenv
  Found existing installation: cffi 1.5.0
    Uninstalling cffi-1.5.0:
      Successfully uninstalled cffi-1.5.0
  Found existing installation: ethereum 1.0.8
    Uninstalling ethereum-1.0.8:
      Successfully uninstalled ethereum-1.0.8
  Found existing installation: requests 2.9.1
    Uninstalling requests-2.9.1:
      Successfully uninstalled requests-2.9.1
  Found existing installation: Werkzeug 0.11.3
    Uninstalling Werkzeug-0.11.3:
      Successfully uninstalled Werkzeug-0.11.3
  Found existing installation: traitlets 4.1.0
    Uninstalling traitlets-4.1.0:
      Successfully uninstalled traitlets-4.1.0
  Found existing installation: pickleshare 0.6
    Uninstalling pickleshare-0.6:
      Successfully uninstalled pickleshare-0.6
  Found existing installation: ipython 4.1.1
    Uninstalling ipython-4.1.1:
      Successfully uninstalled ipython-4.1.1
  Found existing installation: gevent 1.1b3
    Uninstalling gevent-1.1b3:
      Successfully uninstalled gevent-1.1b3
  Found existing installation: click 6.2
    Uninstalling click-6.2:
      Successfully uninstalled click-6.2
  Found existing installation: devp2p 0.6.2
    Uninstalling devp2p-0.6.2:
      Successfully uninstalled devp2p-0.6.2
  Found existing installation: pyethapp 1.0.18
    Uninstalling pyethapp-1.0.18:
      Successfully uninstalled pyethapp-1.0.18
  Found existing installation: hydrachain 0.1.17
    Uninstalling hydrachain-0.1.17:
      Successfully uninstalled hydrachain-0.1.17
  Found existing installation: virtualenv 14.0.6
    Uninstalling virtualenv-14.0.6:
      Successfully uninstalled virtualenv-14.0.6
Successfully installed backports.shutil-get-terminal-size-1.0.0 cffi-1.6.0 click-6.6 devp2p-0.7.2 ethereum-1.3.0 gevent-1.1.0 hydrachain-0.1.17 ipython-4.2.0 lmdb-0.89 pathlib2-2.1.0 pickleshare-0.7.2 pyethapp-1.2.1 requests-2.10.0 secp256k1-0.12.1 six-1.10.0 traitlets-4.2.1 virtualenv-15.0.1 werkzeug-0.11.9
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
pip install -U hydrachain  29.04s user 2.19s system 30% cpu 1:42.57 total
(local) ~ % hydrachain
Usage: hydrachain [OPTIONS] COMMAND [ARGS]...

  Welcome to HydraChain/vundefined/linux2/py2.7.9

Options:
  --profile [livenet|testnet]  Configuration profile.  [default: morden]
  -C, --Config TEXT            Alternative config file
  -c TEXT                      Single configuration parameters
                   (<param>=<value>)
  -d, --data-dir TEXT          data directory  [default:
                   /home/ralf/.config/pyethapp]
  -l, --log_config TEXT        log_config string: e.g. ":info,eth:debug
                   [default: :info]
  --log-json / --log-no-json   log as structured json output
  --log-file PATH              Log to file instead of stderr.
  -b, --bootstrap_node TEXT    single bootstrap_node as
                   enode://pubkey@host:port
  -m, --mining_pct INTEGER     pct cpu used for mining
  --unlock TEXT                Unlock an account (prompts for password)
  --password FILENAME          path to a password file
  --help                       Show this message and exit.

Commands:
  account      Manage accounts.
  blocktest    Start after importing blocks from a file.
  config       Show the config
  export       Export the blockchain to FILE.
  import       Import blocks from FILE.
  run          Start the client ( --dev to stop on error)
  rundummy     run in a zero config default configuration
  runlocal     run in a zero config default configuration
  runmultiple  run multiple nodes in a zero config default...
ulope commented 8 years ago

@schmir: Stange. I just recreated your example in a clean virtualenv and don't get that problem.

Could you run the following code in the same virtualenv:

from pkg_resources import get_entry_info, get_distribution
from pprint import pprint
import hydrachain

print(hydrachain.__file__)
print(get_entry_info('hydrachain==0.3.0', 'console_scripts', 'hydrachain'))
pprint(get_distribution('hydrachain==0.3.0').__dict__)
schmir commented 8 years ago
/home/ralf/local/local/lib/python2.7/site-packages/hydrachain/__init__.pyc
hydrachain = hydrachain.app:app
{'_ep_map': {'console_scripts': {'hydrachain': EntryPoint.parse('hydrachain = hydrachain.app:app')}},
 '_key': 'hydrachain',
 '_provider': <pkg_resources.PathMetadata instance at 0x7fef1ddff560>,
 '_version': '0.3.0',
 'location': '/home/ralf/local/lib/python2.7/site-packages',
 'platform': None,
 'precedence': -1,
 'project_name': 'hydrachain',
 'py_version': None}

(Note the duplicate local/local in the first path)

I have a directory ~/local/local, which looks like:

% ls -la ~/local/local
total 0
drwxr-xr-x 2 ralf ralf  40 Feb 11 22:41 ./
drwxr-xr-x 7 ralf ralf 103 Feb 11 22:44 ../
lrwxrwxrwx 1 ralf ralf  20 Feb 11 22:41 bin -> /home/ralf/local/bin/
lrwxrwxrwx 1 ralf ralf  24 Feb 11 22:41 include -> /home/ralf/local/include/
lrwxrwxrwx 1 ralf ralf  20 Feb 11 22:41 lib -> /home/ralf/local/lib/

I'm pretty sure I didn't create that myself (I am not that drunk!).

The check in hydrachain/init.py needs to resolve symlinks.

I've previously used https://pypi.python.org/pypi/hgdistver (which is now superseeded by setuptools_scm), so that might also be an option (together with reading the version with pkg_resources like you do in the above snippet).