Giter Club home page Giter Club logo

Comments (22)

romanz avatar romanz commented on June 14, 2024 1

It works!
The correct installation for Python 3 is:

python3 -m venv /tmp/v3
. /tmp/v3/bin/activate
pip install 'setuptools>=19.0.0'
pip install protobuf==3.0.0b2.post2      # needed for Python 3 support for protobuf
pip install Cython                       # needed to build python-trezor
pip install git+https://github.com/trezor/python-trezor.git
pip install git+https://github.com/romanz/trezor-agent.git

Thanks :)

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

Thanks for reporting this issue!
Could you please try to run it with Python 2?
I think that there may be a problem with Python 3.

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

As far as I understand, this happens due to non-relative import statement at trezorlib/client.py.
In Python 3, it should be written as:

from . import mapping

from trezor-agent.

ywecur avatar ywecur commented on June 14, 2024

@romanz How do I do that?

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

Sorry for the inconvenience, I will try to prepare a PR to python-trezor to add support for Python 3.
Meanwhile, you can install Python 2 on your machine, and use it to run trezor-agent...

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

trezor/python-trezor#56

from trezor-agent.

slush0 avatar slush0 commented on June 14, 2024

@romanz Please give it a try and tell me back, branch "python3" might work for you already (basic functionality tested on Python 3.4 against emulator, I don't have device with myself).

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

Thanks a lot for the fixes!
There was a small issue at transport_hid (fixed by trezor/python-trezor#57) and after installing protobuf==3.0.0b2.post2 dependency (since protobuf==2.6.1 isn't compatible with Python 3), trezor-agent works like a charm :)

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

@ywecur trezor-agent should work now on Python 3.
Please try it and tell me if it works for you.

python3 -m venv /tmp/v3
. /tmp/v3/bin/activate
pip install protobuf==3.0.0b2.post2      # needed for Python 3 support for protobuf
pip install Cython                       # needed to build python-trezor
pip install git+https://github.com/trezor/python-trezor.git@python3
pip install git+https://github.com/romanz/trezor-agent.git@python3

trezor-agent -vv localhost               # should print you NIST256 SSH public key

EDIT: this may not work - see below: #11 (comment)

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

@ywecur ?

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

Somehow, the latest hidapi package fails to build on Python3:

$ pip install hidapi==0.7.99.post16
Downloading/unpacking hidapi==0.7.99.post16
  Using download cache from /home/roman/.pip_download_cache/https%3A%2F%2Fpypi.python.org%2Fpackages%2F35%2Fe0%2Fc6b3da6999043d96cda6a1c44d5f1054058cc6e5c05b1139886444b31bb0%2Fhidapi-0.7.99.post16.tar.gz
  Running setup.py (path:/tmp/pip-build-fbriuxzv/hidapi/setup.py) egg_info for package hidapi

Installing collected packages: hidapi
  Found existing installation: hidapi 0.7.99.post15
    Uninstalling hidapi:
      Successfully uninstalled hidapi
  Running setup.py install for hidapi
    building 'hid' extension
    error: unknown file type '.pyx' (from 'hid.pyx')
    Complete output from command /media/oldhome/roman/Code/trezor/trezor-agent/v3/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-fbriuxzv/hidapi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-7ybd1pqu-record/install-record.txt --single-version-externally-managed --compile --install-headers /media/oldhome/roman/Code/trezor/trezor-agent/v3/include/site/python3.4:
    running install

running build

running build_ext

building 'hid' extension

error: unknown file type '.pyx' (from 'hid.pyx')

However, hidapi==0.7.99.post15 seems to be working fine (on Python 3).

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

@prusnak Could you please take a look on this issue?

from trezor-agent.

slush0 avatar slush0 commented on June 14, 2024

What version of Cython do you use? I had similar issue and fixed it by installing older Cython version. I did not dig into the problem more as I needed to focus to another thing, but if this will fix problem for you, we should stick the version and report it to cython.

Edit: nevermind, I see its installation from pip where cython is not required anymore.

from trezor-agent.

prusnak avatar prusnak commented on June 14, 2024

setuptools is usually the culprit. make sure you have at least version 19.

edit: setuptools>=19.0 added to install_requires

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

Thanks! I will retry the installation :)

from trezor-agent.

romanz avatar romanz commented on June 14, 2024

Now the installation should be even simpler:

python3 -m venv /tmp/v3
. /tmp/v3/bin/activate
pip install -U setuptools Cython
pip install git+https://github.com/romanz/trezor-agent.git

from trezor-agent.

ecdsa avatar ecdsa commented on June 14, 2024

hello, I'm having the same issue as @romanz when trying to install hidapi with python3:
error: unknown file type '.pyx' (from 'hid.pyx')
it works with hidapi==0.7.99.post15, and it fails with any ulterior version.

from trezor-agent.

prusnak avatar prusnak commented on June 14, 2024

from trezor-agent.

ecdsa avatar ecdsa commented on June 14, 2024
  Downloading hidapi-0.7.99.post20.tar.gz (51kB): 51kB downloaded
  Running setup.py (path:/tmp/pip_build_root/hidapi/setup.py) egg_info for package hidapi
    
Downloading/unpacking setuptools>=19.0 (from hidapi)
  Downloading setuptools-34.2.0-py2.py3-none-any.whl (389kB): 389kB downloaded
Requirement already satisfied (use --upgrade to upgrade): six>=1.6.0 in /usr/local/lib/python3.4/dist-packages (from setuptools>=19.0->hidapi)
Requirement already satisfied (use --upgrade to upgrade): appdirs>=1.4.0 in /usr/local/lib/python3.4/dist-packages (from setuptools>=19.0->hidapi)
Requirement already satisfied (use --upgrade to upgrade): packaging>=16.8 in /usr/local/lib/python3.4/dist-packages (from setuptools>=19.0->hidapi)
Installing collected packages: hidapi, setuptools
  Running setup.py install for hidapi
    building 'hid' extension
    error: unknown file type '.pyx' (from 'hid.pyx')
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/hidapi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-8f18cgdt-record/install-record.txt --single-version-externally-managed --compile:
    running install

running build

running build_ext

building 'hid' extension

error: unknown file type '.pyx' (from 'hid.pyx')

from trezor-agent.

ecdsa avatar ecdsa commented on June 14, 2024

@prusnak I am running the latest setuptools, see above

from trezor-agent.

prusnak avatar prusnak commented on June 14, 2024

Do you have Cython installed? Preferably also latest

from trezor-agent.

ecdsa avatar ecdsa commented on June 14, 2024

@prusnak I have Cython-0.25.2, installed with pip3

from trezor-agent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.