Installing apr on Windows through MinGW, Python not detected - python

I'm trying to install log4cxx with MinGW on my Windows box but need to install apr and apr-util first.
I've been following the guide on Apache's website and installed the version of Python they listed but get an error about Python not being found:
$ buildconf
buildconf: checking installation...
buildconf: python not found.
You need python installed
to build APR from SVN.
I used the Python installer linked in the guide so I assume it's the correct version.
Do I have to tell MinGW or MSYS where Python is and, if so, how do I actually do that?
Also, everything is running 32-bit right now.
Any help would be appreciated!
Thanks

You need to add the location where you installed Python to your PATH environment variable. I would go to the following link that discusses setting PATH in Windows

you need to add the path in MinGw C:\MinGW\msys\1.0\etc in the fstab file as below
Win32_Path Mount_Point
c:/mingw /mingw
c:/ActiveState/perl /perl
C:/Python25

Related

Error during: CREATE EXTENSION plpython3u; on PostgreSQL 9.6.0

I have installed PostgreSQL Server 9.6.0 and Python 3.4.2 on Windows 2012 R2 Server.
I copied plpython3.dll to C:/Program Files/PostgreSQL/9.6/lib/
The in PostgreSQL I try running this command: CREATE EXTENSION plpython3u;
And I receive this message:
ERROR: could not load library "C:/Program Files/PostgreSQL/9.6/lib/plpython3.dll": The specified module could not be found.
Under this folder: C:\Program Files\PostgreSQL\9.6\share\extension there are plpython3u files.
How can I get PostgreSQL to recognize this Python 3 extension?
Thanks!
Copy the python34.dll file to c:\windows\system32 and name the copy python33.dll
The create language plpython3u should then work without a problem.
Exactly the same situation I faced with Postgres 9.6 Windows 10.
PL/Python3U would not get through.
Worked around it:
Installed Python34 64bit Windows 10 version.
Copied Python34.dll to c:\windows\system32 as Python33.dll and it worked.
The information is in Makefile of source installation package
We need libpython as a shared library. In Python >=2.5, configure asks Python directly. But because this has been broken in Debian for a long time (http://bugs.debian.org/695979), and to support older Python versions, we see if there is a file that is named like a shared library as a fallback.
for python windows:
ifeq ($(PORTNAME), win32)
pytverstr=$(subst .,,${python_version})
PYTHONDLL=$(subst \,/,$(WINDIR))/system32/python${pytverstr}.dll
So the write answer is:
WINDIR is : C:\Windows
pytverstr is use in makefile has a parameter to define version of python
PYTHONDLL is the location of dll
To check version of my installation, I open plpython3.dll located in C:\Program Files\PostgreSQL\9.4\lib (change path with your environnement)
With Notepad++ and search PyUnicode_AsUTF8String
the python dll version is visible in last word (in my case python33.dll)
check your installation to choice the good installer of python
SELECT version();
PostgreSQL 9.4.15, compiled by Visual C++ build 1800, 64-bit
So I need install Python 33 in 64bit
edit 2020-10-02
There is also all of these informations in doc of binary ..pgsql\doc\installation-notes.html look at title Procedural Languages
edit 2021-06-11
After install the good version of Python on your system you need copy it to C:\Windows\System32
Replacing the version of python with an old name is not a good solution because you can have librairie it not work with this version. Do that if you know risks. So if you want a newest version of python for plpython, compile it or check edb compilation to check if it contains what you need. You can ask EDB for this information.
plpython3.dll in the official package is built against python 3.3, not python 3.4. What it expect is python33.dll in system32 folder. You need to install python 3.3 for your system.
Since py33 has been phased out, you may soon get frustrated, due to lack of pre-built binary package, lxml, pyzmq etc all needs to be built from source. If you need any binary module, make sure you have a correctly set up compiler.
This may be helpful, I have struggled a lot with this. For me only worked when I installed the right version of python and added paths to environment variables. I am not sure if python 3.4.0 would be the right version for PostgreSQL Server 9.6.0 but it worked fine with PostgreSQL Server 10.0.
Try version python-3.4.0.amd64 for windows 64bit or other versions from this Python 3.4.0 downloads Link
Environment variables to add:
C:\Python34\Scripts
C:\Python34\

How do I get python to import pandas?

I installed Python 3.5.1 from www.python.org. Everything works great. Except that you can't install pandas using pip (it needs visualstudio to compile, which I don't have). So I installed Anaconda (www.continuum.io/downloads). Now I can see pandas as part of the list of installed modules, but when I run python programs I still get:
ImportError: No module named 'pandas'
How do I set up my environment to use the modules from Anaconda?
Note: I have Anaconda's home directory and Library/bin on my path, as well as Python's home directory. I do not have PYTHONPATH or PYTHONHOME set, and I know I have the correct privileges to see everything.
I have successfully installed pandas for a Windows 32 bit version Python 3.4 with pre-complied code (no Visual Studio required) using the website:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyyaml
There is link for Python 3.5 pre-complied code at this site as well, but I have not tested it.
Download the code you want to a directory on your machine.
Using your Windows CMD.exe, go to your python directory and enter:
Python -w pip install "YourDirectory/pandas-0.18.1-cp35-cp35m-win32.whl"
OR
Python -w pip install "YourDirectory/pandas-0.18.1-cp35-cp35m-win_amd64.whl
Choose the version based on the version of Python you have
have, 32 bit or 64 bit.
Good Luck!
Anaconda has included one version of Python with it. You have to change your system environment path with Anaconda's instead of the former one to avoid conflict. Also, if you want to make the whole process easy, it is recommended to use PyCharm, and it will ask you to choose the Python interpreter you want.

Changing default Python 2.x version in XCode 6.1 (Yosemite)

My Mac came with Python 2.6.9 and 2.7.6 (the default 'Python') installed. I needed several modules from the SciPy stack and installed them using MacPorts:
py27-numpy
py27-scipy
py27-matplotlib
py27-pandas
Now for whatever reason this installed another Python version alongside the ones I already had, Python 2.7.8. All the packages only work with this one. When I start a new project in XCode and point it to this new instance, /usr/bin/python2.7, nothing works and I get
'/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file '
I can make XCode work with the 2.7.6 version, /usr/bin/python, but then none of the packages I need are available.
Is there any way to either make XCode work with this other python instance, or to remove the 2.7.6 entirely and replace the default python with the new one?
The correct path to the MacPorts python is /opt/local/bin/python2.7. By using the MacPorts version of Python, you are ensured that all of the necessary dependencies are found. I was able to follow these instructions and get everything to work. The only catch was in step 16 I had to manually enter the path because /opt was not visible.
Alternatively, you could try adding the MacPorts library path to your PYTHONPATH. Just add
export PYTHONPATH=$PYTHONPATH:/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/
to your .bash_profile. I will warn you that when I tried mixing Pythons in the past I frequently got errors relating to trying to import wrong module.

Macports claims python is 2.7.6, however python --version says 2.7.5

I am on osx-mavericks and I am encountering a Segmentation fault: 11 issue.
This SO post: Segmentation fault: 11 in OS X
says that this could be caused by python 2.7.5
I attempted to upgrade python to the next version.
When I do
port installed | grep python
I see:
python27 #2.7.6_0 (active)
However, when I run
python --version
I get
Python 2.7.5
It does the same behavior for python2.7 --version as well. Can anyone help me with this? How do I get python up to 2.7.6? Is it already there and just acting weird? Do I still have 2.7.5 on the machine somewhere? (Also, its worth noting I'm a bit new to the osx development environment)
Thanks to all.
I found the macports python at /opt/local/bin/python, whereas which python showed me /usr/local/bin/python. I changed the order in which these two directories are seen in my PATH and everything seems to work now.
OSX comes with python. It is likely that the version of python on your path is the out of box version. If you use
which python
you should get the directory location of the python you are calling and you can see if it is the macports or OSX version. The OSX Python on my 10.8 mac is in /Library/Frameworks/Python.framework .
Using Ned Deily's comment below you can find the location of the python you want to use from the terminal. Then you can add a line to your ~./bash_profile to set the PYTHONPATH to the version you want to use like this.
export PYTHONPATH=$PYTHONPATH:/path/to/your/python
Then you must reopen the terminal or source the .bash_profile.
source .bash_profile
Then use the which command again to make sure you have the version you want.

Python will not recognize MacPorts installed packages

Thank you in advance for the advice!
Background:
Relative to the people on this site I'm new to programming, and despite some research I'm not familiar with using Unix-type shells, with what managing packages really involves, or with anything which is done outside of the "Dr. Java" IDE or default R GUI. I have a late-2008 macbook with OSX 10.5.8
My Goal:
I'm trying to get the following packages installed in Python: scipy, numpy, matplotlib, networkX
My Story:
From what I understand my 10.5.8 comes installed with a Python 2.5, which the system needs for its functioning, and you really shouldn't mess with. The packages I installed require Python 2.7, so after reformatting my machine, I installed Python 2.7.2 for OSX 10.3 (the latest Python/OSX that was offered of 2.7.X) using the .dmg off of the Python website. Then, I installed XCode using the .dmg (appropriate version for my OS) off of the Apple site, and installed MacPorts (appropriate version for my OS) using the .dmg off of their site. Then, I believe I used MacPorts to install the packages:
sudo port install py27.numpy
However, when I try to import the packages I've apparently installed, Python tells me they don't exist. I'm pretty sure I have only 2 versions of Python on my machine, 2.5 for OSX and 2.7.2 for me (how do I check this?), and if I check which version of Python is running, whether through the Shell or through the IDLE, I get:
>>> import sys
>>> print sys.version
2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 14:13:39)
[GCC 4.0.1 (Apple Inc. build 5493)]
If I run "which python" i get:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
When I check where MacPorts installed the packages using
port contents py27-packagename
I get directories mostly in:
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/
with a few directories in
/opt/local/share/py27-matplotlib/examples/
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/share/doc/networkx-1.5/
and one directory each in
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/f2py
/opt/local/share/doc/py27-matplotlib/CHANGELOG
/opt/local/share/doc/py27-matplotlib/README.txt
/opt/local/share/doc/py27-matplotlib/TODO
My Question:
How do I get Python to recognize my packages?? Ideally I'd like to set it up so I can use the Python IDLE, as well as invoking it from the command line.
I've tried replicating some of the solutions at:
Locate MacPorts package?
But I don't really understand what I'm doing all that well so It's difficult to adapt what's being done there.
Thank you again everyone!
i initially misunderstood your question to be the standard one of - why can't i run my macports python? but in fact, you specified that you are trying to use the self-installed python, and you are. the problem is, that python doesn't know where to look for your libraries which macports installed.
you were on the right track with that question you linked to. see this response, but replace the path with your actual path to your macports libs, viz:
export PYTHONPATH="/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages:$PYTHONPATH"
see if that doesn't do the trick!

Categories