Bob
Bob

Reputation: 8714

Virtual environment wrong python version

I am having a problem with virtual environment and mod_wsgi configuration.

I have this in my apache configuration:

WSGIDaemonProcess myapp python-path=/mnt/myapp/current:/mnt/env/lib/python3.4/site-packages

which clearly states that I am using python3.4.

But if I am in my virtual environment if I do the following, I am getting info that Python version is 3.4.3:

(env)root@Python:/mnt/env/bin# python
Python 3.4.3 (default, Oct 14 2015, 20:28:29) 

But if I list all files in bin folder, I can see that python3.4 is installed.

lrwxrwxrwx 1 root     root           9 Mar 24 10:50 python -> python3.4
lrwxrwxrwx 1 root     root           9 Mar 24 10:50 python3 -> python3.4
-rwxr-xr-x 1 root     root     3709944 Mar 24 10:50 python3.4

In my apache log I am getting this warning:

[Fri Jul 08 10:32:52.394080 2016] [:warn] [pid 29613] mod_wsgi: Compiled for Python/3.4.0.
[Fri Jul 08 10:32:52.394119 2016] [:warn] [pid 29613] mod_wsgi: Runtime using Python/3.4.3.

And this is also from my apache log:

Fri Jul 08 10:53:01.266961 2016] [:error] [pid 29619] Traceback (most recent call last):
[Fri Jul 08 10:53:01.267014 2016] [:error] [pid 29619]   File "/usr/lib/python3.4/threading.py", line 1288, in _shutdown
[Fri Jul 08 10:53:01.268311 2016] [:error] [pid 29619]     assert tlock is not None
[Fri Jul 08 10:53:01.268356 2016] [:error] [pid 29619] AssertionError: 
[Fri Jul 08 10:53:01.259885 2016] [:error] [pid 29621] Exception ignored in: <module 'threading' from '/usr/lib/python3.4/threading.py'>

I am not sure if the last message in the log is connected to the previous, but I assume it is.

Can someone suggest how can I install python version 3.4.3 in my virtual environment? After that I would change mod_wsgi configuration.

Thanks!

Upvotes: 4

Views: 624

Answers (1)

FlipperPA
FlipperPA

Reputation: 14311

It looks like you're using the compiled version of mod_wsgi, which compiles in Python when you first built it, which may have been Python 3.4.0. It looks like what you'll want to do is recompile mod_wsgi against Python 3.4.3 this time, with a something like this:

wget -q "https://github.com/GrahamDumpleton/mod_wsgi/archive/4.4.21.tar.gz"
tar -xzf '4.4.21.tar.gz'
cd ./mod_wsgi-4.4.21
./configure --with-python=/path/to/your/python343/install
make
make install

Good luck!

Upvotes: 3

Related Questions