Change the python version after installing django - python

I am trying to install mod_wsgi and django. When i "make" mod_wsgi then i get error if i use python2.7 but it went ok with default python.
i already wasted much time to figure that but could not solve it.
I just wanted to know that if continue with default python and install Django then can i change the python to 2.7 later
EDIT:
CENTOS5.5
The error i get is
/usr/bin/ld:
/opt/python27/lib/libpython2.7.a(node.o):
relocation R_X86_64_32 against `a
local symbol' can not be used when
making a shared object; recompile with
-fPIC
/opt/python27/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: * [mod_wsgi.la] Error 1
this all heppens if i do
"make" in mod_wsgi directory
Now this error is written on their help site
But i could not configure these things.
According to them
If the version of Python being used
was compiled for X86 64 bit
architecture and a shared library does
exist, but not in the 'config'
directory, then adding the missing
symlink may be all that is required.
i have found that my python version is 64bit . So the only thing left is the other option he talked in above text.
I don't know how to
1) Check if shared library does exist
2) How to add the missing symlink
If i make the mos_wsgi using default python then i get no error.

I just wanted to know that if continue with default python and install Django then can i change the python to 2.7 later
Yes. Upgrades are permitted. AFAIK, there's no law that says you are not permitted to upgrade. Indeed, why ask if an upgrade is possible? Have you been told that you're not permitted to upgrade?
Use the default Python.
Learn Python. Do the entire tutorial.
Install Django.
Learn Django. Do the entire tutorial.
When you go to install mod_wsgi (which you should not do first) please search for CentOS and mod_wsgi. Search is an important skill.
Problem with Django setup using mod_wsgi and apache on centos 5.4
http://library.linode.com/frameworks/django-apache-mod-wsgi/centos-5
And upgrades are permitted. Don't ask for permission. Search for relevant issues.

Related

Cannot install SSL on Python 3.7.1?

I'll start off with saying I read this post already and could not find an answer.
I am on Windows 10, and have been trying to install pipenv through powershell.
Only, it returns me the following error:
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
So I then downloaded ssl-1.16 from this website, but then ran into another error:
ValueError: This extension should not be used with Python 2.6 or later (already built in), and has not been tested with Python 2.3.4 or earlier.
I checked a few forums and still cannot seem to find an answer. So if anyone would know how to come to terms with that, I'd be truly grateful. :)
Thanks

How do I install python on a windows machine using a cygwin terminal?

I am trying to install python through cygwin on a windows machine in order to make use of a statistical program that can only be implemented using python in a linux environment.
I have run setup-x86_64.exe and installed all python related cygwin packages in an attempt to install python, but when I open a terminal and type python I just get
$ python
-bash: python: command not found
which is the same for all python commands I try so clearly the installation has not occurred. However, I have found a path to Python-2.7.9 which appears to contain the files required to build python from source.
When I run ./configure it is successful, but when I then input make it fails due to:
File "build/temp.cygwin-1.7.35-x86_64-2.7/libffi/fficonfig.py", line 33, in <module>
ffi_sources += ffi_platforms['X86_WIN64']
KeyError: 'X86_WIN64'
Makefile:488: recipe for target 'sharedmods' failed
make: *** [sharedmods] Error 1
Anyone know why make won't work?
The options in ./configure --help are unfamiliar to me, could any of these options allow for successful installation?
Any ideas would be greatly appreciated, thank you.
Cygwin comes with an installer, called setup.exe or setup-x86_64.exe. Just run it and type python to the search box. Then let it install it for you.
python language interpreter is the basic package you need.
So, this question is 3 years old, but this error still happens with most recent versions of Python 2 (tested with 2.7.13 and 2.7.15)
I was able to get python to build by modifying the following file in the build directory.
--- build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py~ 2018-11-03 14:51:53.290000000 -0400
+++ build/temp.cygwin-2.11.1-x86_64-2.7/libffi/fficonfig.py 2018-11-03 14:53:41.793000000 -0400
## -9,6 +9,7 ##
'X86': ['src/x86/ffi.c', 'src/x86/sysv.S', 'src/x86/win32.S'],
'X86_FREEBSD': ['src/x86/ffi.c', 'src/x86/freebsd.S'],
'X86_WIN32': ['src/x86/ffi.c', 'src/x86/win32.S'],
+ 'X86_WIN64': ['src/x86/ffi.c', 'src/x86/win64.S'],
'SPARC': ['src/sparc/ffi.c', 'src/sparc/v8.S', 'src/sparc/v9.S'],
'ALPHA': ['src/alpha/ffi.c', 'src/alpha/osf.S'],
'IA64': ['src/ia64/ffi.c', 'src/ia64/unix.S'],
The source files, in particular src/x86/win64.S, are present in the source tree. For some reason, ./configure does not seem to be properly adding the option to the dictionary in the fficonfig.py file, which causes the KeyError posted in the question. After making this modification, make and make install completed successfully and I was able to install an alternate version of python in addition to the normal Cygwin package.
I'm not yet sure why this happens, but I thought I would attempt to provide a solution to the question actually asked rather than just telling the asker to install a pre-compiled version using the package manager.
Since building Python from source was said to be a bad idea, I assumed my Cygwin was broken. I attempted to uninstall Cygwin following the instructions on the Cygwin website, but I was unable to remove it due to permission difficulties (I use a university-supplied Windows machine). My last resort was to run the Cygwin installation wizard setup-x86_64.exe and uninstall all packages, then run the wizard once more and select the necessary packages again as if starting from new. Miraculously, installing the required packages from scratch solved the problem and I am now running Python through my Cygwin terminal with no errors.
If you want to run Python on Cygwin, you might need to build it from source.
download the source
unpack it to the directory you could delete later, eg: build
run Cygwin, type: cd /path/to/build
run ./configure --help and read the help about the options you'll need
./configure #options
make

Pydb compilation issue for python 3.3 as user with limited access rights

I am trying to compile pydb for python 3.3, but I have limited access right on my environment.
To avoid accessing forbidden areas, I used the following configure command:
./configure --prefix=/my/prefix
--with-python=/my/python/path/python3.3
--with-site-packages=/my/site/package/path/mysite-packages
But configure complains about the version of python:
checking whether /sw/freetools/python/3.3.0/Linux/rh5/x86_64/bin/python version >= 2.4.0... configure: error: too old
I didn't have the issue when compiling for python 2.7.2.
Could someone help me to solve this installation issue?
Thank you!
I managed to compile (in cygwin) like this:
PYTHON=python3 ./configure --with-site-packages=/usr/lib/python3.6/site-packages

Error: Command failed with rc=65536 python and mod_wsgi

i'm having this problem:
i'm runing pythonbrew to get python2.7, and so i re-compiled mod_wsgi to use the 2.7 python.
to that end, i followed this tutorial:
code.google.com/p/modwsgi/wiki/QuickInstallationGuide
which involved downloading the file - there is a tar.gz file i get - and then "configuring it" with ./configure --with-python=/home/bharal/.pythonbrew/pythons/Python-2.7.2/bin/python --enable-shared
now i'm assuming this is the right place to attach for my python - the value for with-python above is just the response i get to a which python
OK! So, now the problem. After i run the configure above, i run make and i get:
/usr/include/features.h:160:1: warning: this is the location of the previous definition
/usr/share/apr-1.0/build/libtool --silent --mode=link --tag=disable-static x86_64-linux-gnu-gcc -o mod_wsgi.la -rpath /usr/lib/apache2/modules -module -avoid-version mod_wsgi.lo -L/home/aiyer /.pythonbrew/pythons/Python-2.7.2/lib -L/home/aiyer/.pythonbrew/pythons/Python-2.7.2/lib /python2.7/config -lpython2.7 -lpthread -ldl -lutil -lm
/usr/bin/ld: /home/bharal/.pythonbrew/pythons/Python-2.7.2/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC
/home/aiyer/.pythonbrew/pythons/Python-2.7.2/lib/libpython2.7.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
And i have no idea what to do. I came across this answer is SO:
https://stackoverflow.com/a/6118155/1061426
but this doesn't help me any much - it isn't as far as i can tell a series of steps, but more an interesting tidbit to think about.
I ran this command to check if i have python 64 bit:
import sys
print maxint
if 64 bit ==> 9223372036854775807
if 32 bit ==> 2147483647
ok, so i'm totes running 64bit because i get the bigger number. So i read this doco here:
http://code.google.com/p/modwsgi/wiki/InstallationIssues#Mixing_32_Bit_And_64_Bit_Packages
because i'm running the 64 bit python, does that mean that my problem isn't this:
This error is believed to be result of the version of Python being used having been originally compiled for the generic X86 32 bit architecture whereas mod_wsgi is being compiled for X86 64 bit architecture. The actual error arises in this case because 'libtool' would appear to be unable to generate a dynamically loadable module for the X86 64 bit architecture from a X86 32 bit static library.
but rather this?
Alternatively, the problem is due to 'libtool' on this platform not being able to create a loadable module from a X86 64 bit static library in all cases.
(the above quotes from the above link)
and if that is the case, what the heck do i do? I haven't the foggiest notion what to do in either scenario - and yes, i read the rest of that page, but it might as well have been written in greek ( i don't speak greek ).
any suggestions?
UPDATE:
i never fixed this and ended up using the python my ubuntu came with - no difference from the running of my code's point of view.
The documentation says:
If the first issue, the only solution to this problem is to recompile
Python for the X86 64 bit architecture. When doing this, it is
preferable, and may actually be necessary, to ensure that the
'--enable-shared' option is provided to the 'configure' script for
Python when it is being compiled and installed.
So, you need to reinstall Python from source code, ensuring the '--enable-shared' option is supplied to the 'configure' command for Python prior to running 'make'.
If 'pythonbrew' doesn't allow you to do that, then tell the pythonbrew people that the way they are building their Python version with shared library support is arguably broken and will prevent many embedded systems from failing to run.
Having come across this problem myself with Fedora 19 64bit, I found that the mod_wsgi would compile and install from source if I installed both the Python-devel and httpd-devel packages.
I am not using pythonbrew however.
My Dear Python developers, I was also getting the same error, and here is how I got it fixed. The very first step is that you'll have install python with --enable-shared option. Next thing, Make sure you have dev dependencies installed for both Apache and Python. sudo apt-get install apache2-dev and sudo apt-get install python3.8-dev. I was using Python 3.8 so i install python3.8-dev. You need to install the one matching with your python version.
In addition to this, read this aricle and follow the instruction closely, given here https://modwsgi.readthedocs.io/en/develop/user-guides/quick-installation-guide.html#apache-requirements
I just followed it and was able to make it work properly.

Mac OSX-Lion Python-LDAP Unrecognized Symbol: _ber_pvt_opt_on

I've been trying to run a web server based in Python 2.6 code here at work. The server requires the python LDAP libraries in order to run. Because I'm working on Mac OS X Lion, I needed to run a manual install of python-ldap 2.4.7 in order to get Python to recognize LDAP at all. Python-ldap appeared to intall correctly, but when I try to run the web server I get the following error (I added some line breaks for the sake of clarity):
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/python_ldap-2.4.7-py2.6-macosx-10.7-fat.egg/_ldap.so, 2): Symbol not found: _ber_pvt_opt_on
Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/python_ldap-2.4.7-py2.6-macosx-10.7-fat.egg/_ldap.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/python_ldap-2.4.7-py2.6-macosx-10.7-fat.egg/_ldap.so
I'm using OpenLDAP 2.4.21, and I set the following system variables before running my python-ldap installation:
export ARCHFLAGS="-arch i386"
export CFLAGS="-isysroot /Developer/SDKs/MacOSX10.7.sdk -arch i386"
export MACOSX_DEPLOYMENT_TARGET="10.7"
I should also probably mention that I've had to force everything I've installed to use 32-bit architecture instead of 64-bit in order to work around some issues with Oracle's 64-bit support. Has anyone encountered a similar situation, or do they know the significance of the "_ber_pvt_opt_on" symbol that LDAP was looking for? The number of Google results I was able to come up with was both small and unhelpful. Any light that you could shed on the situation would be greatly appreciated.

Categories