unbit / uwsgi-docs

Official uWSGI docs, examples, tutorials, tips and tricks
MIT License
640 stars 346 forks source link

Error linking uwsgi using pip, missing `libpython3.10.a` #514

Closed HectorMenezes closed 2 years ago

HectorMenezes commented 2 years ago

I'm trying to install uwsgi within a conda environment through pip and getting an error. My distribution is the Ubuntu 20.04.5 LTS. Conda version and steps to reproduce:

$ conda --version
conda 4.14.0

$ conda create -y -n test-venv python=3.10
$ conda activate test-venv

$ pip --version
pip 22.3 from /home/hectormenezes/anaconda3/envs/test-venv/lib/python3.10/site-packages/pip (python 3.10)

$ pip install uwsgi

Error:

*** uWSGI linking ***
      gcc -pthread -B /home/hectormenezes/anaconda3/envs/test-venv/compiler_compat -o /home/hectormenezes/anaconda3/envs/test-venv/bin/uwsgi  core/utils.o core/protocol.o core/socket.o core/logging.o core/master.o core/master_utils.o core/emperor.o core/notify.o core/mule.o core/subscription.o core/stats.o core/sendfile.o core/async.o core/master_checks.o core/fifo.o core/offload.o core/io.o core/static.o core/websockets.o core/spooler.o core/snmp.o core/exceptions.o core/config.o core/setup_utils.o core/clock.o core/init.o core/buffer.o core/reader.o core/writer.o core/alarm.o core/cron.o core/hooks.o core/plugins.o core/lock.o core/cache.o core/daemons.o core/errors.o core/hash.o core/master_events.o core/chunked.o core/queue.o core/event.o core/signal.o core/strings.o core/progress.o core/timebomb.o core/ini.o core/fsmon.o core/mount.o core/metrics.o core/plugins_builder.o core/sharedarea.o core/rpc.o core/gateway.o core/loop.o core/cookie.o core/querystring.o core/rb_timers.o core/transformations.o core/uwsgi.o proto/base.o proto/uwsgi.o proto/http.o proto/fastcgi.o proto/scgi.o proto/puwsgi.o lib/linux_ns.o core/zlib.o core/yaml.o core/ssl.o core/legion.o core/xmlconf.o core/dot_h.o core/config_py.o plugins/python/python_plugin.o plugins/python/pyutils.o plugins/python/pyloader.o plugins/python/wsgi_handlers.o plugins/python/wsgi_headers.o plugins/python/wsgi_subhandler.o plugins/python/web3_subhandler.o plugins/python/pump_subhandler.o plugins/python/gil.o plugins/python/uwsgi_pymodule.o plugins/python/profiler.o plugins/python/symimporter.o plugins/python/tracebacker.o plugins/python/raw.o plugins/gevent/gevent.o plugins/gevent/hooks.o plugins/ping/ping_plugin.o plugins/cache/cache.o plugins/nagios/nagios.o plugins/rrdtool/rrdtool.o plugins/carbon/carbon.o plugins/rpc/rpc_plugin.o plugins/corerouter/cr_common.o plugins/corerouter/cr_map.o plugins/corerouter/corerouter.o plugins/fastrouter/fastrouter.o plugins/http/http.o plugins/http/keepalive.o plugins/http/https.o plugins/http/spdy3.o plugins/ugreen/ugreen.o plugins/signal/signal_plugin.o plugins/syslog/syslog_plugin.o plugins/rsyslog/rsyslog_plugin.o plugins/logsocket/logsocket_plugin.o plugins/router_uwsgi/router_uwsgi.o plugins/router_redirect/router_redirect.o plugins/router_basicauth/router_basicauth.o plugins/zergpool/zergpool.o plugins/redislog/redislog_plugin.o plugins/mongodblog/mongodblog_plugin.o plugins/router_rewrite/router_rewrite.o plugins/router_http/router_http.o plugins/logfile/logfile.o plugins/router_cache/router_cache.o plugins/rawrouter/rawrouter.o plugins/router_static/router_static.o plugins/sslrouter/sslrouter.o plugins/spooler/spooler_plugin.o plugins/cheaper_busyness/cheaper_busyness.o plugins/symcall/symcall_plugin.o plugins/transformation_tofile/tofile.o plugins/transformation_gzip/gzip.o plugins/transformation_chunked/chunked.o plugins/transformation_offload/offload.o plugins/router_memcached/router_memcached.o plugins/router_redis/router_redis.o plugins/router_hash/router_hash.o plugins/router_expires/expires.o plugins/router_metrics/plugin.o plugins/transformation_template/tt.o plugins/stats_pusher_socket/plugin.o -lpthread -lm -rdynamic -ldl -lz -lssl -lcrypto -lexpat -lcrypt -lpthread -ldl -lutil -lrt -lm -lm /home/hectormenezes/anaconda3/envs/test-venv/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.a -lutil -lcrypt
      gcc: error: /home/hectormenezes/anaconda3/envs/test-venv/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.a: No such file or directory
      *** error linking uWSGI ***
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> uwsgi

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

The file libpython3.10.a is indeed missing, and I think I cannot replace it with another file in my environment:

$ find ~/anaconda3/envs/test-venv -name "*.a"
/home/hectormenezes/anaconda3/envs/test-venv/lib/tdbc1.1.3/libtdbcstub1.1.3.a
/home/hectormenezes/anaconda3/envs/test-venv/lib/itcl4.2.2/libitclstub4.2.2.a
/home/hectormenezes/anaconda3/envs/test-venv/lib/libncurses++w.a
/home/hectormenezes/anaconda3/envs/test-venv/lib/libtkstub8.6.a
/home/hectormenezes/anaconda3/envs/test-venv/lib/libtclstub8.6.a
/home/hectormenezes/anaconda3/envs/test-venv/lib/libffi.a
/home/hectormenezes/anaconda3/envs/test-venv/lib/libuuid.a
/home/hectormenezes/anaconda3/envs/test-venv/lib/libbz2.a
/home/hectormenezes/anaconda3/envs/test-venv/lib/libncurses++.a
$ find ~/anaconda3/envs/test-venv -name "libpython*"
/home/hectormenezes/anaconda3/envs/test-venv/lib/libpython3.10.so
/home/hectormenezes/anaconda3/envs/test-venv/lib/libpython3.10.so.1.0
/home/hectormenezes/anaconda3/envs/test-venv/lib/libpython3.so

I found some similar files at /usr/lib, but pip gave me another error when coping to environment (failed to set dynamic section sizes: bad value):

$ find /usr -name libpython3.10.a
/usr/lib/python3.10/config-3.10-x86_64-linux-gnu/libpython3.10.a
/usr/lib/x86_64-linux-gnu/libpython3.10.a

My coworker can also experience this error, how can I correctly create libpython3.10.a? I honestly think I should not be responsible for managing static C libraries, did I miss some step to avoid this problem?

IamPecker commented 2 years ago

您的邮件我已收到,我将会尽快给您回复信息。

akx commented 2 years ago

I'm not an Anaconda expert (and I prefer to stay that way), but have you tried if the conda-forge version works?

xrmx commented 2 years ago

On conda use conda not pip please.

nykcrystal commented 3 months ago

I had the same problem. Did you solve it?

IamPecker commented 3 months ago

您的邮件我已收到,我将会尽快给您回复信息。

HectorMenezes commented 3 months ago

Yes. TBH, I don't remember exactly how, I probably just installed via conda. I used to use pip as the default way to install packages, but it's discouraged by conda's docs.