为什么我不能在OSX上的pipenv中安装m2crypto?

时间:2018-06-07 12:36:07

标签: python django python-3.x pipenv

任何人都知道我可能做错了什么。我试图从pip3切换到pipenv我在尝试安装uwsgi和m2crpyot时不断在osx上出现此错误:https://pastebin.com/FZZUpcwa

pipenv install -r requirements2.txt
Requirements file provided! Importing into Pipfile…
Pipfile.lock (6adb91) out of date, updating to (10e36a)…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (10e36a)!
Installing dependencies from Pipfile.lock (10e36a)…
An error occurred while installing https://gitlab.com/m2crypto/m2crypto/-/archive/0.27.0/m2crypto-0.27.0.zip#egg=4dd1b7f! Will try again.
An error occurred while installing lxml==3.6.1! Will try again.
     ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 95/95 — 00:03:30
An error occurred while installing uwsgi==2.0.14! Will try again.
Installing initially–failed dependencies…
Collecting 4dd1b7f from https://gitlab.com/m2crypto/m2crypto/-/archive/0.27.0/m2crypto-0.27.0.zip#egg=4dd1b7f
Installing collected packages: 4dd1b7f

Exception:
Traceback (most recent call last):
  File "/Users/timo/.local/share/virtualenvs/jm-web-G18c0xlX/lib/python3.6/site-packages/pip/_internal/basecommand.py", line 228, in main
    status = self.run(options, args)
  File "/Users/timo/.local/share/virtualenvs/jm-web-G18c0xlX/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 335, in run
    use_user_site=options.use_user_site,
  File "/Users/timo/.local/share/virtualenvs/jm-web-G18c0xlX/lib/python3.6/site-packages/pip/_internal/req/__init__.py", line 49, in install_given_reqs
    **kwargs
  File "/Users/timo/.local/share/virtualenvs/jm-web-G18c0xlX/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 748, in install
    use_user_site=use_user_site, pycompile=pycompile,
  File "/Users/timo/.local/share/virtualenvs/jm-web-G18c0xlX/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 961, in move_wheel_files
    warn_script_location=warn_script_location,
  File "/Users/timo/.local/share/virtualenvs/jm-web-G18c0xlX/lib/python3.6/site-packages/pip/_internal/wheel.py", line 316, in move_wheel_files
    assert info_dir, "%s .dist-info directory not found" % req
AssertionError: 4dd1b7f .dist-info directory not found

  ☤  ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/3 — 00:00:00

我在使用pip on mac之前遇到了类似问题,我可以修复 是我在使用pip时使用的先前修正:https://yoirtuts.com/index.php?title=M2Crypto_Issue_Mac_OSXhttps://yoirtuts.com/index.php?title=Compile_Issue_With_UWSGI_On_OSX

我试过在码头工人中做这件事,在码头工人外面只是普通的pipenv。我不知道自己做错了什么。似乎问题出在m2crypto上。在过去,我不得不像这样使用pip安装m2crypto :(在OSX上使用普通pip3和virtualenv时:

pip3 install m2crypto --global-option=build_ext --global-option="-L/usr/local/opt/openssl/lib" --global-option="-I/usr/local/opt/openssl/include"

并且使用uwsgi我偶尔会遇到问题,我可以解决:(在使用pip3的virtualenv中)

CFLAGS="-Wno-error=varargs" pip3 install -r requirements.txt

只是对问题的更新:

我尝试在docker容器中安装m2crypto,而不使用requirements.txt并使用Pipfile。所以换句话说使用这个命令从Pipfile安装:(所以这是在dockerfile中用于在构建映像时安装依赖项)

RUN pipenv install --system --deploy

这就是我在m2pypto

的Pipfile中添加的内容
m2crypto = "==0.27.0"

这是我不断得到的错误:

    copying M2Crypto/BN.py -> build/lib.linux-x86_64-3.6/M2Crypto
    creating build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/cb.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/ssl_dispatcher.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/timeout.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/SSLServer.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/Cipher.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/TwistedProtocolWrapper.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/Context.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/__init__.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/Session.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/Connection.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    copying M2Crypto/SSL/Checker.py -> build/lib.linux-x86_64-3.6/M2Crypto/SSL
    warning: build_py: byte-compiling is disabled, skipping.

    running build_ext
    building 'M2Crypto._m2crypto' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/SWIG
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include/python3.6m -I/tmp/pip-install-qdabh1md/m2crypto/SWIG -c SWIG/_m2crypto_wrap.c -o build/temp.linux-x86_64-3.6/SWIG/_m2crypto_wrap.o -DTHREADING
 -Wno-deprecated-declarations
    SWIG/_m2crypto_wrap.c: In function ‘_wrap__STACK_num_set’:
    SWIG/_m2crypto_wrap.c:9493:19: error: dereferencing pointer to incomplete type ‘struct stack_st’
       if (arg1) (arg1)->num = arg2;
                       ^~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new__STACK’:
    SWIG/_m2crypto_wrap.c:9720:48: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st’
       result = (struct stack_st *)calloc(1, sizeof(struct stack_st));
                                                    ^~~~~~
    SWIG/_m2crypto_wrap.c:9723:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_new_null’:
    SWIG/_m2crypto_wrap.c:9866:1: warning: label ‘fail’ defined but not used [-Wunused-label]
     fail:
     ^~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_sk_deep_copy’:
    SWIG/_m2crypto_wrap.c:9951:40: warning: passing argument 2 of ‘OPENSSL_sk_deep_copy’ from incompatible pointer type [-Wincompatible-pointer-types]
       result = (_STACK *)sk_deep_copy(arg1,arg2,arg3);
                                            ^~~~
    In file included from /usr/include/openssl/crypto.h:28:0,
                     from /usr/include/openssl/bio.h:20,
                     from /usr/include/openssl/err.h:21,
                     from SWIG/_m2crypto_wrap.c:3557:
    /usr/include/openssl/stack.h:32:16: note: expected ‘OPENSSL_sk_copyfunc {aka void * (*)(const void *)}’ but argument is of type ‘void * (*)(void *)’
     OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, OPENSSL_sk_copyfunc c, OPENSSL_sk_freefunc f);
                    ^~~~~~~~~~~~~~~~~~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_stack_st_OPENSSL_STRING_stack_set’:
    SWIG/_m2crypto_wrap.c:10354:19: error: dereferencing pointer to incomplete type ‘struct stack_st_OPENSSL_STRING’
       if (arg1) (arg1)->stack = *arg2;
                       ^~
    SWIG/_m2crypto_wrap.c:10354:29: error: dereferencing pointer to incomplete type ‘OPENSSL_STACK {aka struct stack_st}’
       if (arg1) (arg1)->stack = *arg2;
                                 ^~~~~
    SWIG/_m2crypto_wrap.c: In function ‘_wrap_new_stack_st_OPENSSL_STRING’:
    SWIG/_m2crypto_wrap.c:10386:63: error: invalid application of ‘sizeof’ to incomplete type ‘struct stack_st_OPENSSL_STRING’
       result = (struct stack_st_OPENSSL_STRING *)calloc(1, sizeof(struct stack_st_OPENSSL_STRING));

2 个答案:

答案 0 :(得分:0)

基于this post,我可以使用以下命令进行安装:

conditionalPromiseFlow(
  () => authorizedApi(jwtClient),
  () => sendContactMessage(gmailAPI, encodedContactMessage),
  () =>
    findContact(
      googlePeopleAPI.connections,
      googleConnectionListParams,
      sender.email
    ),
  () => createContact(googlePeopleAPI, googlePeopleContactParams)
)
  .then(
    res => {
      return { status: 200, infos: "done" };
    },
    error => {
      return { status: error.status, infos: error.message };
    }
  )
  .then(response => {
    return res.send(response);
  })
  .catch(console.error);

答案 1 :(得分:-1)

尝试:

sudo apt-cache search libssl

在此之后,尝试使用apt-get“ libssl1.0-dev ”或列表中的类似软件包进行安装。这可能会有所帮助。 例如,对我来说,此命令是:

sudo apt-get install libssl1.0-dev