PyMesh problems with Setup on Windows10 and Error using Docker Version - windows

I want to install PyMesh on a Windows 10 PC, if possible it should be installed in the side-packages of an interpreter delivered with the IDE we use.
I tried the way to run the setup discribed here
https://pymesh.readthedocs.io/en/latest/installation.html
so the part :
git clone https://github.com/PyMesh/PyMesh.git
cd PyMesh
git submodule update --init
worked without any problems.
I am not sure on windows if I now just can write
set PYMESH_PATH = path
and if i can use the path "...\PyMesh\PyMesh" here?
so i left out this part
I installed numpy and scipy (allready installed)
and nose because it is mentioned in the requirements.txt.
So my numpy scipy and nose versions are
numpy 1.19.1
scipy 1.6.0
nose 1.3.7 (same as requirenments)
and just run the setup.py with admin rights
python .\setup.py install
which also seemed to work but i got an error trying
python -c "import pymesh; pymesh.test()"
from the PyMesh folder
saying ModuleNotFoundError: No module named 'PyMesh'
or if i go up one Folder doing the same
saying AttributeError: module 'PyMesh' has no attribute 'triangle'
I found this link ImportError: No module named PyMesh
but i just dont know what i should type in there
I tried to install via pip by using pip install pymesh
but pip Installer gives me a different library.
So i tried in the docker version and in docker i tried the pymesh.load_mesh method with an stl File
but got
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
I dont know if this is just the stl format (expecting binary getting ascii or vice versa)
The stl file itself can be opened so shouldnt be corrupted.
So is there a different way to install pymesh? A wheel would be great. Is it possible to install pymesh to the side-packages of a given Interpreter? Did someone else allready had the same error in Docker and knows the issue
thank you for your help

Related

Installing specific versions of pyproj from github

I have been trying to install obspy and have been running into a lot of problems. I want to install obspy which has a dependency on pyproj. But apparently obspy only works with pyproj 1.9.5.1, which I tried installing using pip (pip3 install pyproj==1.9.5.1), but only got the errors like-
_proj.c:7488:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
Digging deeper I found that it might be a Cython problem, and installing pyproj directly from github might help, because it would apparently make Cython recompile all the necessary files. Something along the lines of -
pip3 install git+https://github.com/jswhit/pyproj.git
However this one gives the error -
ERROR: Minimum supported proj version is 6.2.0, installed version is 5.2.0.
I di try installing a higher version of libproj-dev (sudo apt install libproj-dev=6.2.0) however it shows that there is no candidate for 6.2.0. I tried downloading the deb file and installing from that using -
sudo apt-get install ~/Downloads/libproj-dev_6.2.0-1_amd64.deb
which just leads to the error -
The following packages have unmet dependencies:
libproj-dev : Depends: libproj15 (= 6.2.0-1) but it is not installable
E: Unable to correct problems, you have held broken packages.
But I think this is not the right way to install for me anyway, since I need a specific version. Hence I tried installing directly from the tarball of the release -
pip3 install https://github.com/pyproj4/pyproj/archive/v1.9.5.1rel.tar.gz
Which leads to the first error I had, evidently due to Cython.
With errors on everything I tried to do to fix this, I am not sure what even is relevant to my problem now.
Any help is appreciated, and if this site is not the correct place for this question, please help me migrate it to its proper destination.
I am on Ubuntu 18.10.
The problem is, that Cython-generated c-files don't work for Python-3.7 if generated with Cython versions up to 0.27.3 (at least): The setup.py of pyproj (at least in the version 1.9.5.1) doesn't regenerate the_proj.c, which is generated with Cython 0.23.2 and thus the installation cannot succeed.
You have the following options:
stay on Python3.6 where everything works out of the box.
regenerate _proj.c with a current Cython-version.
For the second option:
download and unzip your prefered version from https://github.com/pyproj4/pyproj/releases/tag/v1.9.5.1rel and switch to the created folder pyproj-1.9.5.1rel.
check, that the cython-version is >=0.27.3. via cython --version.
regenerate the _proj.c file via cython -3 _proj.pyx (_proj.pyx looks like Python3-code, but also language_level=2 (i.e. cython -2 _proj.pyx) will probably work.
install running pip install .
pyproj 1.9.5.1 was release at Jan 7, 2016. At that time, the latest version Python was 3.5. In my tests. pyproj 1.9.5.1 failed to be installed on Python 3.7.4, but succeeded on Python 3.5.7.
You need to create a environment with Python 3.5 by pyenv or conda.
References
pyproj 1.9.5.1 release
Python release history

ImportError: No module named googlemaps

I've installed this package via pip27 on macports. My OS is OSX El Capitan 10.11.6. My python install is 2.7.10.
I'm trying to run an example script that imports googlemaps module, but I keep getting that ImportError. I have a feeling that it's how pip installed it and the reason why python can't find it, but I'm relatively new to pip so I don't know where to start investigating.
I also tried googling for a fix but no dice. Any idea what's happening here?
Here's my code:
import googlemaps # can't import
import argparse
from datetime import datetime
# collect args for lat, long, # of addresses, radius of search
parser = argparse.ArgumentParser(description='Randomize addresses on Google Maps')
parser.add_argument('-lt', '--latitude')
parser.add_argument('-lng', '--longitude')
parser.add_argument('-n', '--count')
parser.add_argument('-r', '--radius')
args = parser.parse_args()
print('Results: ', vars(args))
Error message:
Traceback (most recent call last):
File "randomize_addresses.py", line 1, in <module>
import googlemaps
ImportError: No module named googlemaps
Found a fix. I uninstalled googlemaps via pip and then reinstalled using easy_install. Apparently OSX doesn't like pip.
Looks like you used pre-installed python since you mentioned version 2.7.10 (default version shipped with macOS) which is located at /usr/bin/.
MacPorts installs binaries and libraries under /opt/local. Try to install python via MacPorts and run the program again. Python and pip should both be linked so that packages installed via pip is available to python.
In this case packages installed using pip27 would be available to python27 installed via MacPorts and not /usr/bin/python.
Another way would be to download get-pip.py and install it against /usr/bin/python (pip installation guide).
Note: Make sure you are using python installed via MacPorts. To check this run which python, it should show something like /opt/local/bin/python2.7

Why can't pip find pysvn?

I'm working on a project which was written in Python 2, and I'm upgrading it to Python 3. So far, I've just been finding minor syntax errors which are easily fixable. What I've done is created a new project in Python 3, ensured that it worked, and copies chunks of code from the old project into the new one.
Right now, I'm having trouble with pysvn. Initially, I was getting this error:
ImportError: No module named 'pysvn'
At this point, I tried using pip install pysvn, which didn't work. I got the following:
pip install pysvn
Collecting pysvn
Could not find a version that satisfies the requirement pysvn (from versions:)
No matching distribution found for pysvn
So then after a bit of research, I went to the pysvn download site and tried:
>pip install --index-url http://pysvn.tigris.org/project_downloads.html pysvn, which gave me this error:
Collecting pysvn
The repository located at pysvn.tigris.org is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host pysvn.tigris.org'.
and also the same error as when I tried >pip install pysvn.
My next step was to manually download the .exe file for the version I needed, and I was able to successfully install pysvn. I have checked the site-packages directory, and pysvn is indeed there, but pip still can't tell me anything about it:
>pip show pysvn
>
When I do this for another installed module, selenium for example, I get the following:
pip show selenium
Metadata-Version: 1.1
Name: selenium
Version: 2.49.2
Summary: Python bindings for Selenium
Home-page: https://github.com/SeleniumHQ/selenium/
Author: UNKNOWN
Author-email: UNKNOWN
License: UNKNOWN
Location: ...\lib\site-packages
Requires:
I was able to verify that the installation of pysvn was successful because my project now runs instead of giving me that ImportError.
So why can pip not give me information for another module in the same directory that was successfully installed?
As it turns out, because I didn't use pip install for pysvn, pip didn't know that pysvn existed. Because it wasn't available from PyPI (the Python Package Index), there was no way that pip could see it (because that's where pip goes first to find packages that it's attempting to install).
From the pip user guide:
pip supports installing from PyPI, version control, local projects, and directly from distribution files.
Since I had eventually downloaded pysvn from its own download site (which was not any of the above 4 options) and ran the .exe manually, pip simply doesn't know about it even though it's in the same directory as other packages installed by pip.
I suppose I could've also retrieved the distribution files and used pip with those, but my workaround did the trick.
My way on linux:
Get sources from here
tar -zxf pysvn-1.9.10.tar.gz
apt-get install subversion libsvn1 libsvn-dev make g++
cd pysvn-1.9.10/Source
python setup.py configure --pycxx-dir=/pysvn-1.9.10/Import/pycxx-7.1.3/
make
Here i've got errors below:
Compile: /pysvn-1.9.10/Import/pycxx-7.1.3/Src/cxxsupport.cxx into cxxsupport.o
/pysvn-1.9.10/Import/pycxx-7.1.3/Src/cxxsupport.cxx:42:10: fatal error: Src/Python3/cxxsupport.cxx: No such file or directory
#include "Src/Python3/cxxsupport.cxx"
Compile: /pysvn-1.9.10/Import/pycxx-7.1.3/Src/cxxextensions.c into cxxextensions.o
/pysvn-1.9.10/Import/pycxx-7.1.3/Src/cxxextensions.c:42:10: fatal error: Src/Python3/cxxextensions.c: No such file or directory
#include "Src/Python3/cxxextensions.c"
It is needed to edit that files:
vi /pysvn-1.9.10/Import/pycxx-7.1.3/Src/cxxsupport.cxx
change #include "Src/Python3/cxxsupport.cxx" to
#include "Python3/cxxsupport.cxx"
and same on second file. Than make again:
make clean && make
...
Compile: /code/pysvn-1.9.10/Import/pycxx-7.1.3/Src/cxxextensions.c into cxxextensions.o
Compile: /code/pysvn-1.9.10/Import/pycxx-7.1.3/Src/IndirectPythonInterface.cxx into IndirectPythonInterface.o
Compile: /code/pysvn-1.9.10/Import/pycxx-7.1.3/Src/cxx_exceptions.cxx into cxx_exceptions.o
Link pysvn/_pysvn_3_7.so
Then just copy it to the site-packages (change to yours directory):
mkdir /usr/local/lib/python3.7/site-packages/pysvn
cp /code/pysvn-1.9.10/Sources/pysvn/__init__.py /usr/local/lib/python3.7/site-packages/
cp /code/pysvn-1.9.10/Sources/pysvn/_pysvn*.so /usr/local/lib/python3.7/site-packages/

kmpfit module not in Kapteyn v2.2 module list

I am using Python 2.7 through Anaconda 2.7.8 and need Kapteyn 2.2 to perform Non-linear Least Squares fitting easily (it is probably an alternative to Scipy.optimize.leastsq() for dummies like me!).
After copy-pasting this from a previous post here on Stack Overflow:
conda install -c https://conda.binstar.org/dhirschfeld pyodbc
and then running on my cmd (as I did not have pyodbc installed I think, because of which maybe the command prompt on my Windows 7 64-bit system was not responding well to python setup.py install inside the Anaconda directory where I unzipped the Kapteyn .zip file downloaded from University of Groningen website.
But, after the installing pyodbc properly and running python setup.py install, the cmd gave me an error saying error: command 'C:\Users\windows 7\Anaconda\Scripts\gcc.bat' failed with exit status 1. Later, when I tried to import kmpfit module (needed for Non-linear least square fitting with Kapteyn), here is the problem:
import kapteyn
help(kapteyn)
Help on package kapteyn:
NAME
kapteyn - Kapteyn package.
FILE
c:\users\windows 7\anaconda\kapteyn\__init__.py
PACKAGE CONTENTS
_ni_support
celestial
doccer
filters
interpolation
maputils
mplutil
positions
rulers
shapes
tabarray
wcsgrat
DATA
__all__ = ['celestial', 'wcs', 'wcsgrat', 'tabarray', 'maputils', 'mpl...
__version__ = '2.2'
VERSION
2.2
As you can see, there is no module named kmpfit (or even wcs) here. But according to http://www.astro.rug.nl/software/kapteyn/intro.html, these two should be there.
Kindly help. I have never imported any module before.
Thanks in advance...:-)
I just managed to get this working (on Mac OSX, so you may have to adjust this). My steps were:
$ conda install pyodbc (didn't need to go through binstar)
Download & unarchive the kapteyn package, then navigate to its directory
$ python setup.py install, which used my OS's C compiler and Anaconda's python, and installed kapteyn to my anaconda distro's site-packages, as it should.
Check that kmpfit.so is in the kapteyn folder in site-packages, showing that kmpfit installed correctly.
>> from kapteyn import kmpfit failed, ImportError: cannot import name kmpfit. I did some digging and discovered that it was still importing kapteyn from the folder that I downloaded, not from site-packages.
Delete the downloaded kapteyn folder, then try again. It worked!

How to install Scrapy on Mac OS X 10.7 ? (lxml error)

I'm a total newbie concerning Python and I have trouble installing Scrapy on Mac OS X 10.7. I've tried a lot of different things, but in summary, when I run:
scrapy startproject tutorial
I've got these errors :
ImportError: dlopen(/Library/Python/2.7/site-packages/lxml/etree.so, 2): Symbol not found: ___xmlStructuredErrorContext
Referenced from: /Library/Python/2.7/site-packages/lxml/etree.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/lxml/etree.so
After a lot of googling, I've followed this post and tried:
python setup.py build --static-deps --libxml2-version=2.7.8 && pip install lxml
but it tells me:
RuntimeError: ERROR: Trying to build without Cython, but pre-generated 'src/lxml/lxml.etree.c' is not available (pass --without-cython to ignore this error).
And if I run the same command with the —without-cython option, I get:
error: command 'llvm-gcc-4.2' failed with exit status 1
(though I've installed XCode command line tools)
Thanks in advance for your help !
(fyi, I am using MacPorts and pip install…)
You mention Macports at the end and also pip. I think you are mixing up packaging and installation methods.
The first import error should not be seen using a macports python as it puts its libraries under /opt/
As you have started on macports I would use the easy way
port install py27-scrapy
This will install all the needed packages (including python and lxml) to get scrapyto work.
To run scrapy you would need to use the macports python in /opt/local/bin/python2.7. This can be set as the default python if /opt/local/bin is on your path and you run port select to choose this as the python found. The scrapy executable script is /opt/local/bin/scrapy-2.7 Version numbers are used because you can have multiple versions of python working at once.

Resources