Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python pip install mod_wsgi fails with possible unicode error

I am trying to host a web app with Flask. I have a VPS running CentOS. I have Apache 2.2.26 installed.

When I run pip install mod_wsgi either in a virtual environment OR on my main Python installation, I get the following errors

This first error is printed before the Python trace...

/usr/bin/ld: /home5/arguably/python27/lib/python2.7/config/libpython2.7.a(abstra     ct.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when maki     ng a shared object; recompile with -fPIC

/home5/arguably/python27/lib/python2.7/config/libpython2.7.a: could not read sym     bols: Bad value

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

that error is looking at my main Python installation. That's not where the virtualenv is located

The Python error...

Traceback (most recent call last):
  File "/home/arguably/webapps/ers_2/ers2venv/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/arguably/webapps/ers_2/ers2venv/lib/python2.7/site-packages/pip/__     init__.py", line 185, in main
    return command.main(cmd_args)
  File "/home/arguably/webapps/ers_2/ers2venv/lib/python2.7/site-packages/pip/ba     secommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 43: ordinal not in range(128)

That one IS looking at my virtualenv

The lines from the file in the Python trace text = '\n'.join(complete_log) ..

if store_log:
            log_file_fn = options.log_file
            text = '\n'.join(complete_log)
            try:
                log_file_fp = open_logfile(log_file_fn, 'w')
            except IOError:
                temp = tempfile.NamedTemporaryFile(delete=False)
                log_file_fn = temp.name
                log_file_fp = open_logfile(log_file_fn, 'w')
like image 526
Brian Leach Avatar asked Dec 22 '25 04:12

Brian Leach


1 Answers

Your Python installation has not been installed with a shared library. This is required for mod_wsgi. See the mod_wsgi documentation.

  • http://code.google.com/p/modwsgi/wiki/InstallationIssues#Mixing_32_Bit_And_64_Bit_Packages

Reinstall your Python from scratch and this time use --enable-shared to the configure script for Python when building it.

like image 99
Graham Dumpleton Avatar answered Dec 24 '25 10:12

Graham Dumpleton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!