How To Install GEOS for GeoDjango on Windows - windows

I'm starting a GeoDjango project using Python 2.5, Django 1.2, MySQL and Apache. The project will be uploaded to a Linux server but the development will be on a Windows.
The problem is I just can't get passed installing GEOS, how is it done?

I follow the instructions in
http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#windows
For the instalation of GEOS library in windows i use this:
http://trac.osgeo.org/osgeo4w/

what I did is to install GDAL from this answer, Unable to install Python and GDAL (DLL load failed), and then add this line to settings.py,
GEOS_LIBRARY_PATH = 'C:/Program Files/GDAL/geos_c.dll'
then it is fine to use postgis.

Follow this tutorial it will Install GDAL complete library including GEOS.
Just did it yesterday worked fine
http://www.gis.usu.edu/~chrisg/python/2009/docs/gdal_win.pdf

Related

Install chromedriver on Mac M1 at specific location?

I just made the jump from Ubuntu to MacBook Air M1.
I am trying to set-up the system in a way that I don't have to change scripts for both. i.e. I want to keep the scripts in such a way that editing on either system is ok.
In a script I use the following line of code:
driver = webdriver.Chrome("/usr/lib/chromium-browser/chromedriver")
I used Homebrew to install chromium-browser but I can't find the file (so I can move it to this location?).
I have tried almost everything I could look up and can't figure it out. What can I try next?
Install webdriver-manager, it allows you install and store chromedrive automatically
pip install webdriver-manager
and use like this:
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())
The fastest way to to solve is using Home Brew:
brew install --cask chromedriver
Chromedriver will be installed in the correct path.
You can find the downloads for various versions of the Chrome driver here: https://chromedriver.chromium.org/downloads
For example, for v99 on Mac M1 you could download this archive: https://chromedriver.storage.googleapis.com/99.0.4844.51/chromedriver_mac64_m1.zip
Once downloaded just unzip & copy to whatever location you choose. After I installed I still needed to mark the application as "safe" in macOS, I followed the instructions here: https://stackoverflow.com/a/60362134/1371489

Cannot Install dlib and OpenCV together in Anaconda for required python-versions' mismatch

I am trying to develop a system that requires OpenCV and dlib to be installed in anaconda to work with. I tried a lot to install dlib package in latest anaconda (Anaconda3-2019.03-Windows-x86_64) distribution. But it says to downgrade the python version. Again I also found the dlib package does not still support python3.7. See here the available versions:
https://pypi.org/simple/dlib/
Than I created a virtual environment having python3.6. But I faced another type of error. It cannot play video file (mp4). But it works fine if the video is taken from webcam. It shows the following error:
gray=cv.cvtColor(frame,cv.COLOR_BGR2GRAY) error: ..\..\..\modules\imgproc\src\color.cpp:3739: error: (-215) scn == 3 || scn == 4 in function cv::cvtColor
As I found this error occurs when it doesn't find any video file. But in my case there is no reason of not finding a video file. I tried both by using video file name (keeping it in the same folder) and full path as well. It behaves the same.
Than I installed Anaconda3 (5.0.1) which comes with python3.6 which should work fine but I failed to install OpenCV using command:
conda install -c conda-forge OpenCV
It says:
CondaError: Cannot link a source that does not exist. C:\Users\Username\Anaconda3\Scripts\conda.exeRunning `conda clean --packages` may resolve your problem.
It throws the same error even if I try to install OpenCV after cleaning conda packeges.
With which versions of these navigator, python, OpenCV and dlib I can make a stable working environment for my work and how?
Summarizing what I want:
A stable anaconda installation
Can work with dlib and OpenCV libraries
No problem in working with video files. No matter it comes from
webcam or other saved video.
Please help me :(
Well I solved this problem myself. These are what I did:
Removing existing Anaconda distribution "Completely". Follow
instructions from here:
https://docs.anaconda.com/anaconda/install/uninstall/
Installing Anaconda3 5.2.0 from here (this version comes with python
3.6.5 that satisfies the requirements):
https://repo.anaconda.com/archive/Anaconda3-5.2.0-Windows-x86_64.exe
Installing OpenCV from Anaconda prompt. See here:
https://anaconda.org/conda-forge/opencv
Installing dlib (19.7.0) from Anaconda prompt using this command:
pip install https://pypi.python.org/packages/da/06/bd3e241c4eb0a662914b3b4875fc52dd176a9db0d4a2c915ac2ad8800e9e/dlib-19.7.0-cp36-cp36m-win_amd64.whl#md5=b7330a5b2d46420343fbed5df69e6a3f
Done!
NB:
Here I got some of the steps from the following posts:
For uninstalling Anaconda I found the solution from: How to remove anaconda from windows completely? | Answered by: Jakob
For installing dlib I found the solution from: dlib installation on Windows 10 | Answered by: Marco D.G.
I am thankful to them as well.

Unable to install pyinstaller

setup.py within the folder raises:
setup.py is not yet supposed to work. Please Use PyInstaller without installation.
as mentioned here. I couldn't follow the solution mentioned there. "pip install pyinstaller" raises the same error. I unzipped the 2.0 version but am now stuck on how to proceed. (for clarification - I want to install pyinstaller-2.0 on my machine so that I can use it to bundle Python modules and send it to others). I have looked at this and this but still no luck. OS = Mountain Lion and Python = 2.7. Pls. help.
I found that installing the development version solved it when I had the problem.

Psycopg installation on windows

I am trying to install psycopg2 under Windows (Windows 7, 64 bit). I am using Python 2.7.2 from Python(x,y) and PostgreSQL 9.2.1 .
My first try was using the windows port that is downloadable from http://www.stickpeople.com/projects/python/win-psycopg/ (psycopg2-2.4.5.win-amd64-py2.7-pg9.1.3-release.exe). I get a message then that
Python 2.7 required but was not found in the registry
In the next dialogue it does not allow me to choose any python installations. All other programs and installations find my python happily.
This being failed, I tried to use the source package directly from http://pypi.python.org/pypi/psycopg2 but after trying:
python setup.py install
I am now stuck with the error message:
error: Unable to find vcvarsall.bat
Does anybody have an idea how to solve this?
You're using a different Python distribution to the one the psycopg2 installer expects, so it cannot find the Python install location.
You can manually install psycopg2 from the binaries you downloaded by following the instructions on the psycopg2 download page for issues installing with Zope, which read:
It has been noted that the the installers for psycopg2 will not find
the zope installation of python, stop the installation, and not
installing psycopg2. A work around is to extract the files by renaming
the extension from *.exe to *.zip and using a zip extractor (such as
WinZip/PkZip/7z) to extract the psycopg2 folder and place it at
\lib\python. I do not use Zope, so I will not be able to
provide support or instructions on how to use it. Let me know if it
does not work, though.
The same will apply to the Python(x,y) distribution that you are using. Unzip the psycopg2 installer .exe using 7-zip, then copy the psycopg2 folder and 'psycopg2-2.5.2-py2.7.egg-info' file (so 'psycopg2' will apear on 'pip freeze') into your Python lib\site-packages directory. See installing Python modules.
You should then be able to import psycopg2.
Choose the appropriate version from this page:
http://www.stickpeople.com/projects/python/win-psycopg/
Right click and select copy link address
Back at home, use easy_install <<Paste URL Here>>
Freeze your new requirements: pip freeze > requirements.txt

Where is PyGTK for Mac OS X?

Is there a binary out there for the current mac os x, python for PyGTK? I work with multiple desktop environments (mac, windows, gnome) and really consider python's lack of cross platform GUI's a problem. Does anyone know where I can find a built version of PyGTK and GTK for Mac?
I cant clone the git repository, it keeps timing out.
brew install pygtk worked for me (requires homebrew).
Confirmed to work with OS X 10.10 too, but by default it will install it into brew's Python distribution, so if you are still using the native python, it will not find it.
I don't use macports but it seems that jhbuild works for me. Below is the steps that I've done.
download gtk-osx-build-setup.sh from: https://raw.github.com/jralls/gtk-osx-build/master/gtk-osx-build-setup.sh and save it to your home directory.
fire up terminal and navigate to your home directory and run the command sh gtk-osx-build-setup.sh
the shell script will warn you that ~/.local/bin isn't added to your environment variable to do this, edit your .profile file located at your home directory and /Users/<username>/.local/bin to your environment variable. to know more on how to edit this file check out: http://www.tech-recipes.com/rx/2621/os_x_change_path_environment_variable/
after that, do a ~/.local/bin/jhbuild bootstrap command. it will download and install some necessary utilities.
download and install the beta version of the gtk+ osx framework at: http://ftp.imendio.com/pub/imendio/gtk-osx/Gtk-Framework-2.14-LATEST.dmg
before installing the meta-gtk-osx-python, you need to build and install some other packages that jhbuild doesn't install automatically, so what i did was i installed libpng by doing the command: ~/.local/bin/jhbuild build libpng
you also need to install libtiff so do the command: ~/.local/bin/jhbuild build libtiff
and also gtk-doc is needed so: ~/.local/bin/jhbuild build gtk-doc
and finally you can now install meta-gtk-osx-python by doing a: ~/.local/bin/jhbuild build meta-gtk-osx-python
Let me know if it works.
There is an installer for PyGTK 2.24 in test here, announced on the PyGTK list.
UPDATE project has moved on macpkg's sourceforge page.
I couldn't make it work with meld (segmentation fault), but sample PyGTK programs work OK.
UPDATE 2 since then a new package Py3GTK3 appeared on the same sourceforge page. Haven't tested though.
There is now a mac package on sourceforge
Download the latest package from http://sourceforge.net/projects/macpkg/files/PyGTK/ and install.
If you're just trying to use the system python, this is all you'll have to do.
If you're not, the following is how to install it with pyenv, which can be installed with Homebrew. With brew installed, you can install version pyenv and Python 2.7.8 with:
brew install pyenv && pyenv install 2.7.8
After you've done that, you'll then have copy the gtk package and its dependencies into your python installation:
cd /opt/gtk/lib/python2.7/site-packages/ && \
cp * ~/.pyenv/versions/2.7.8/lib/python2.7/site-packages/
That's it. You can also similarly install the Py3GTK3 package which has packages for python 2.7 and 3.2 from http://sourceforge.net/projects/macpkg/files/Py3GTK3/.
Have you tried doing it using macports? This website shows how.

Resources