无法使用pip3安装eth-testrpc

时间:2018-08-04 18:52:48

标签: python pip ethereum

我无法使用pip3为python 3.6安装eth-testrpc;这是错误

/ tmp / pip-build-9xf75aun / secp256k1 /

中的命令“ python setup.py egg_info”失败,错误代码为1

问题是我可以使用pip,但无法使用。

任何ID

整个错误在这里

millahue@millahue-ProLiant-ML350e-Gen8:~$  sudo pip3 install eth-testrpc
The directory '/home/millahue/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/millahue/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting eth-testrpc
  Downloading https://files.pythonhosted.org/packages/bc/9a/8a8c90b8ed4db0afc39bc7b67b52aa8cbbc9c08bbd93f7ca92719e3493a3/eth_testrpc-1.3.5-py3-none-any.whl
Collecting click>=6.6 (from eth-testrpc)
  Downloading https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 3.1MB/s 
Collecting Werkzeug>=0.11.10 (from eth-testrpc)
  Downloading https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl (322kB)
    100% |████████████████████████████████| 327kB 2.2MB/s 
Collecting ethereum<2.0.0,>=1.6.1 (from eth-testrpc)
  Downloading https://files.pythonhosted.org/packages/8d/d2/f20638de4c3ab6a28a64c079a7e20cede57491d872c6ce62b2e6839adfe6/ethereum-1.6.1.tar.gz (128kB)
    100% |████████████████████████████████| 133kB 3.8MB/s 
Collecting json-rpc>=1.10.3 (from eth-testrpc)
  Downloading https://files.pythonhosted.org/packages/61/5d/271952ce266b7a4f0a0b4b714a640ebca19fed520a4f8a011ee9752fbf52/json_rpc-1.11.0-py2.py3-none-any.whl (40kB)
    100% |████████████████████████████████| 40kB 4.2MB/s 
Collecting rlp<=0.6.0,>=0.4.7 (from eth-testrpc)
Collecting pbkdf2 (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
  Downloading https://files.pythonhosted.org/packages/02/c0/6a2376ae81beb82eda645a091684c0b0becb86b972def7849ea9066e3d5e/pbkdf2-1.3.tar.gz
Collecting secp256k1 (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
  Downloading https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz (156kB)
    100% |████████████████████████████████| 163kB 3.4MB/s 
    Complete output from command python setup.py egg_info:
    'pkg-config' is required to install this package. Please see the README for details.

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-9xf75aun/secp256k1/

AKX提供的答案解决了这个问题,但是现在我有了这个:

millahue@millahue-ProLiant-ML350e-Gen8:~$ sudo pip3 install eth-testrpc
The directory '/home/millahue/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/millahue/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting eth-testrpc
  Downloading https://files.pythonhosted.org/packages/bc/9a/8a8c90b8ed4db0afc39bc7b67b52aa8cbbc9c08bbd93f7ca92719e3493a3/eth_testrpc-1.3.5-py3-none-any.whl
Requirement already satisfied: json-rpc>=1.10.3 in ./.local/lib/python3.6/site-packages (from eth-testrpc)
Requirement already satisfied: Werkzeug>=0.11.10 in ./.local/lib/python3.6/site-packages (from eth-testrpc)
Collecting ethereum<2.0.0,>=1.6.1 (from eth-testrpc)
Collecting click>=6.6 (from eth-testrpc)
  Downloading https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl (71kB)
    100% |████████████████████████████████| 71kB 2.5MB/s 
Requirement already satisfied: rlp<=0.6.0,>=0.4.7 in ./.local/lib/python3.6/site-packages (from eth-testrpc)
Collecting secp256k1 (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
  Downloading https://files.pythonhosted.org/packages/52/62/d7bf3829e126e517e253d2e22a63511c54bbaac34d7ddea316cde040fc49/secp256k1-0.13.2.tar.gz (156kB)
    100% |████████████████████████████████| 163kB 2.4MB/s 
Requirement already satisfied: pycryptodome>=3.3.1 in ./.local/lib/python3.6/site-packages (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: bitcoin in ./.local/lib/python3.6/site-packages (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: pbkdf2 in ./.local/lib/python3.6/site-packages (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: repoze.lru in ./.local/lib/python3.6/site-packages (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: pyethash in ./.local/lib/python3.6/site-packages (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: PyYAML in ./.local/lib/python3.6/site-packages (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: pysha3>=1.0.1 in ./.local/lib/python3.6/site-packages (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: scrypt in ./.local/lib/python3.6/site-packages (from ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: cffi>=1.3.0 in ./.local/lib/python3.6/site-packages (from secp256k1->ethereum<2.0.0,>=1.6.1->eth-testrpc)
Requirement already satisfied: pycparser in ./.local/lib/python3.6/site-packages (from cffi>=1.3.0->secp256k1->ethereum<2.0.0,>=1.6.1->eth-testrpc)
Installing collected packages: secp256k1, ethereum, click, eth-testrpc
  Running setup.py install for secp256k1 ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-965hbamf/secp256k1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-w018n13n-record/install-record.txt --single-version-externally-managed --compile:
    0.29.1
    Using bundled libsecp256k1
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/secp256k1
    copying secp256k1/__main__.py -> build/lib.linux-x86_64-3.6/secp256k1
    copying secp256k1/__init__.py -> build/lib.linux-x86_64-3.6/secp256k1
    running build_clib
    libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
    libtoolize: copying file 'build-aux/ltmain.sh'
    libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
    libtoolize: copying file 'build-aux/m4/libtool.m4'
    libtoolize: copying file 'build-aux/m4/ltoptions.m4'
    libtoolize: copying file 'build-aux/m4/ltsugar.m4'
    libtoolize: copying file 'build-aux/m4/ltversion.m4'
    libtoolize: copying file 'build-aux/m4/lt~obsolete.m4'
    configure.ac:10: installing 'build-aux/compile'
    configure.ac:5: installing 'build-aux/config.guess'
    configure.ac:5: installing 'build-aux/config.sub'
    configure.ac:9: installing 'build-aux/install-sh'
    configure.ac:9: installing 'build-aux/missing'
    Makefile.am: installing 'build-aux/depcomp'
    parallel-tests: installing 'build-aux/test-driver'
    checking build system type... x86_64-pc-linux-gnu
    checking host system type... x86_64-pc-linux-gnu
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... no
    checking for mawk... mawk
    checking whether make sets $(MAKE)... yes
    checking whether make supports nested variables... yes
    checking how to print strings... printf
    checking for style of include used by make... GNU
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking whether gcc understands -c and -o together... yes
    checking dependency style of gcc... none
    checking for a sed that does not truncate output... /bin/sed
    checking for grep that handles long lines and -e... /bin/grep
    checking for egrep... /bin/grep -E
    checking for fgrep... /bin/grep -F
    checking for ld used by gcc... /usr/bin/x86_64-linux-gnu-ld
    checking if the linker (/usr/bin/x86_64-linux-gnu-ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm -B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 1572864
    checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format... func_convert_file_noop
    checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for /usr/bin/x86_64-linux-gnu-ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... no
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for ranlib... ranlib
    checking command to parse /usr/bin/nm -B output from gcc object... ok
    checking for sysroot... no
    checking for a working dd... /bin/dd
    checking how to truncate binary pipes... /bin/dd bs=4096 count=1
    checking for mt... mt
    checking if mt is a manifest tool... no
    checking how to run the C preprocessor... gcc -E
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if gcc supports -fno-rtti -fno-exceptions... no
    checking for gcc option to produce PIC... -fPIC -DPIC
    checking if gcc PIC flag -fPIC -DPIC works... yes
    checking if gcc static flag -static works... yes
    checking if gcc supports -c -o file.o... yes
    checking if gcc supports -c -o file.o... (cached) yes
    checking whether the gcc linker (/usr/bin/x86_64-linux-gnu-ld -m elf_x86_64) supports shared libraries... yes
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... no
    checking whether to build static libraries... yes
    checking whether make supports nested variables... (cached) yes
    checking for pkg-config... /usr/bin/pkg-config
    checking pkg-config is at least version 0.9.0... yes
    checking for ar... /usr/bin/ar
    checking for ranlib... /usr/bin/ranlib
    checking for strip... /usr/bin/strip
    checking for gcc... gcc
    checking whether we are using the GNU C compiler... (cached) yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... (cached) none needed
    checking whether gcc understands -c and -o together... (cached) yes
    checking dependency style of gcc... (cached) none
    checking how to run the C preprocessor... gcc -E
    checking for gcc option to accept ISO C89... (cached) none needed
    checking dependency style of gcc... none
    checking if gcc supports -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings... yes
    checking if gcc supports -fvisibility=hidden... yes
    checking for __int128... yes
    checking for __builtin_expect... yes
    checking native compiler: gcc... ok
    checking for x86_64 assembly availability... yes
    checking for CRYPTO... yes
    checking for main in -lcrypto... yes
    checking for EC functions in libcrypto... yes
    checking for javac... no
    configure: WARNING: cannot find JDK; try setting $JAVAC or $JAVA_HOME
    checking jni headers... none
    configure: WARNING: jni headers/dependencies not found. jni support disabled
    checking whether byte ordering is bigendian... no
    configure: Using static precomputation: yes
    configure: Using assembly optimizations: x86_64
    configure: Using field implementation: 64bit
    configure: Using bignum implementation: no
    configure: Using scalar implementation: 64bit
    configure: Using endomorphism optimizations: no
    configure: Building ECDH module: no
    configure: Building Schnorr signatures module: no
    configure: Building ECDSA pubkey recovery module: yes
    configure: Using jni: no
    checking that generated files are newer than configure... done
    configure: creating ./config.status
    config.status: creating Makefile
    config.status: creating libsecp256k1.pc
    config.status: creating src/libsecp256k1-config.h
    config.status: executing depfiles commands
    config.status: executing libtool commands
      CC       src/libsecp256k1_la-secp256k1.lo
    In file included from /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/secp256k1.c:14:0:
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_context_clone’:
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:186:9: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
             memcpy(dst->pre_g, src->pre_g, size);
             ^~~~~~
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:186:9: warning: incompatible implicit declaration of built-in function ‘memcpy’
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:186:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_wnaf’:
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:230:5: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
         memset(wnaf, 0, len * sizeof(wnaf[0]));
         ^~~~~~
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:230:5: warning: incompatible implicit declaration of built-in function ‘memset’
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:230:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
      CCLD     libsecp256k1.la
    /usr/bin/ar: `u' modifier ignored since `D' is the default (see `U')
      CC       src/tests-tests.o
    In file included from /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/secp256k1.c:14:0,
                     from /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/tests.c:16:
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_context_clone’:
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:186:9: warning: implicit declaration of function ‘memcpy’ [-Wimplicit-function-declaration]
             memcpy(dst->pre_g, src->pre_g, size);
             ^~~~~~
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:186:9: warning: incompatible implicit declaration of built-in function ‘memcpy’
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:186:9: note: include ‘<string.h>’ or provide a declaration of ‘memcpy’
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h: In function ‘secp256k1_ecmult_wnaf’:
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:230:5: warning: implicit declaration of function ‘memset’ [-Wimplicit-function-declaration]
         memset(wnaf, 0, len * sizeof(wnaf[0]));
         ^~~~~~
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:230:5: warning: incompatible implicit declaration of built-in function ‘memset’
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/ecmult_impl.h:230:5: note: include ‘<string.h>’ or provide a declaration of ‘memset’
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/tests.c: In function ‘test_ecdsa_der_parse’:
    /tmp/pip-build-965hbamf/secp256k1/libsecp256k1/src/tests.c:3702:52: error: dereferencing pointer to incomplete type ‘ECDSA_SIG {aka struct ECDSA_SIG_st}’
             valid_openssl = !BN_is_negative(sig_openssl->r) && !BN_is_negative(sig_openssl->s) && BN_num_bits(sig_openssl->r) > 0 && BN_num_bits(sig_openssl->r) <= 256 && BN_num_bits(sig_openssl->s) > 0 && BN_num_bits(sig_openssl->s) <= 256;
                                                        ^~
    Makefile:1049: recipe for target 'src/tests-tests.o' failed
    make: *** [src/tests-tests.o] Error 1
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-965hbamf/secp256k1/setup.py", line 295, in <module>
        "Topic :: Security :: Cryptography"
      File "/home/millahue/.local/lib/python3.6/site-packages/setuptools/__init__.py", line 131, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python3.6/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/lib/python3.6/distutils/dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/home/millahue/.local/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/lib/python3.6/distutils/command/install.py", line 589, in run
        self.run_command('build')
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/usr/lib/python3.6/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/lib/python3.6/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/lib/python3.6/distutils/dist.py", line 974, in run_command
        cmd_obj.run()
      File "/tmp/pip-build-965hbamf/secp256k1/setup.py", line 217, in run
        subprocess.check_call(["make"], cwd=build_temp)
      File "/usr/lib/python3.6/subprocess.py", line 291, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['make']' returned non-zero exit status 2.

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-965hbamf/secp256k1/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-w018n13n-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-965hbamf/secp256k1/

1 个答案:

答案 0 :(得分:3)

完整的输出说起来很简单:

  

secp256k1:     安装此软件包需要'pkg-config'。有关详细信息,请参见自述文件。

您可以在此处阅读自述文件:https://github.com/ludbb/secp256k1-py

对于Ubuntu,您需要

sudo apt install build-essential automake pkg-config libtool libffi-dev libgmp-dev

首先,然后重试。

编辑:第二个错误似乎源于捆绑的libsecp256k1与系统的OpenSSL版本不兼容。您可以尝试安装系统提供的libsecp256k1,而当您重试pip安装时,Python绑定应该可以将其拾取:

sudo apt install libsecp256k1-dev