Syntax error when installing the spkg package of wxPython on Sage - python

When I want to install the package wxPython-2.8.7.1.spkg from here
in the terminal of Sage it gives me a syntax error. What i write in Sage terminal and the result are as follow:
sage: sage -i wxPython-2.8.7.1.spkg
------------------------------------------------------------
File "<ipython console>", line 1
sage -i wxPython-RealNumber('2.8').gen(7).1.spkg
^
SyntaxError: invalid syntax
I also use the direct address of the package but the result was the same:
sage: sage -i http://www.sagemath.org/packages/experimental/wxPython-2.8.7.1.s>
------------------------------------------------------------
File "<ipython console>", line 1
sage -i http://www.sagemath.org/packages/experimental/wxPython-RealNumber('2.8').gen(7).1.spkg
^
SyntaxError: invalid syntax
I also downloaded the package and used the local address but the result was the same.

You need to do this from the command line before starting Sage. Otherwise you can use
sage: install_package("wxPython")
which is currently downloading for me... and then failed:
checking for GTK+ - version >= 2.0.0... no
*** Could not run GTK+ test program, checking why...
*** The test program failed to compile or link. See the file config.log for the
*** exact error that occured. This usually means GTK+ is incorrectly installed.
configure: error:
The development files for GTK+ were not found. For GTK+ 2, please
ensure that pkg-config is in the path and that gtk+-2.0.pc is
installed. For GTK+ 1.2 please check that gtk-config is in the path,
and that the version is 1.2.3 or above. Also check that the
libraries returned by 'pkg-config gtk+-2.0 --libs' or 'gtk-config
--libs' are in the LD_LIBRARY_PATH or equivalent.
Error configure wx widgets.
real 0m13.972s
user 0m2.791s
sys 0m5.232s
************************************************************************
Error installing package wxPython-2.8.7.1
************************************************************************
Along those lines, here is what it says at the list of experimental spkgs, of which this is one:
These are EXPERIMENTAL! They probably won't work at all for you! Use at your own risk! Many of these have never been successfully built on any platform!
So buyer beware!

Related

ImportError: No module named libvirt error whyle trying to install python for libvirt on NetBSD 9.2

I've just installed virt-manager with pkgin on NetBSD 9.2 just because I want to emulate the virtual machines with qemu + nvmm on NetBSD 9.2. The installation of virt-manager went ok. But,when I ran it,an error came up :
netbsd-marietto# virt-manager
Traceback (most recent call last):
File "/usr/pkg/share/virt-manager/virt-manager.py", line 386, in <module>
main()
File "/usr/pkg/share/virt-manager/virt-manager.py", line 247, in main
from virtManager import cli
File "/usr/pkg/share/virt-manager/virtManager/cli.py", line 29, in <module>
import libvirt
ImportError: No module named libvirt
Googling a little bit maybe I've found the solution here :
https://www.unitedbsd.com/d/285-linux-user-and-netbsd-enthusiast-hoping-to-migrate-some-day
where "kim" said :
Looking at pkgsrc/sysutils/libvirt/PLIST it doesn't look like the package provides any Python bindings -- which is what the "ImportError: No module named libvirt" error message is about. You could try py-libvirt from pkgsrc-wip and see how that works out.
I tried to start the compilation like this :
netbsd-marietto# cd /home/mario/Desktop/pkgsrc-wip/py-libvirt
netbsd-marietto# make
but I've got this error :
make: "/home/mario/Desktop/pkgsrc-wip/py-libvirt/Makefile" line 15: Could not find ../../wip/libvirt/buildlink3.mk
make: "/home/mario/Desktop/pkgsrc-wip/py-libvirt/Makefile" line 16: Could not find ../../lang/python/distutils.mk
make: "/home/mario/Desktop/pkgsrc-wip/py-libvirt/Makefile" line 17: Could not find ../../mk/bsd.pkg.mk
make: Fatal errors encountered -- cannot continue
If u want to see the content of the Makefile,it is :
gedit /home/mario/Desktop/pkgsrc-wip/py-libvirt/Makefile
#$NetBSD: Makefile,v 1.32 2018/11/30 09:59:40 adam Exp $
PKGNAME= ${PYPKGPREFIX}-${DISTNAME:S/-python//}
DISTNAME= libvirt-python-5.8.0
CATEGORIES= sysutils python
MASTER_SITES= https://libvirt.org/sources/python/
MAINTAINER= pkgsrc-users#NetBSD.org
HOMEPAGE= https://libvirt.org/sources/python/
COMMENT= libvirt python library
LICENSE= gnu-lgpl-v2
USE_TOOLS+= pkg-config
.include "../../wip/libvirt/buildlink3.mk"
.include "../../lang/python/distutils.mk"
.include "../../mk/bsd.pkg.mk"
Can someone help me to fix the error ? very thanks.
You are getting those errors because your copy of pkgsrc wip is not inside a pkgsrc tree.
Please follow the pkgsrc wip documentation to correctly use pkgsrc wip. Especially look at the section titled Getting the "source".
In brief, assuming you have a copy of pkgsrc in /usr/pkgsrc and you want to use git to checkout pkgsrc wip, run these commands:
cd /usr/pkgsrc
git clone git://wip.pkgsrc.org/pkgsrc-wip.git wip
Then build py-libvirt with these commands:
cd /usr/pkgsrc/wip/py-libvirt
make
If it builds successfully, you could install it with:
cd /usr/pkgsrc/wip/py-libvirt
make install

Sphinx not using the right Python version inside virtual environments

I've created a virtual environment using both virtualenv and pipenv and in the both cases it seems that sphinx is not able to figure out the correct Python version. I have installed Python 2.7 and Python 3.8 in my global environment.
The error shows up when I try to use sphinx-apidoc + make html. I'm on a Windows 10 machine. Because I'm using type annotations, I get this error:
(venv) C:\Users\eug\Documents\learning\learning-pdoc\docs>make html
Running Sphinx v1.8.5
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 3 source files that are out of date
updating environment: 3 added, 0 changed, 0 removed
reading sources... [100%] sample_package
WARNING: autodoc: failed to import module u'core' from module u'sample_package'; the following exception was raised:
Traceback (most recent call last):
File "c:\python27\lib\site-packages\sphinx\ext\autodoc\importer.py", line 154, in import_module
__import__(modname)
File "C:\Users\eug\Documents\learning\learning-pdoc\sample_package\core.py", line 4
def sample_function2(a : Number, b : Number)->Number:
^
SyntaxError: invalid syntax
As you can see I'm currently on the virtual environment (venv). Calling python by itself correctly calls the right version. In order to execute what I want I need to call:
python -m sphinx.cmd.build -M html . .
Which is not ideal. Is there a way to fix this?

Installing megam for NLTK on Windows

I need to install megam for nltk classification routines in Python.
I followed the instruction by Milk Magic from this post:
0. Downloaded megam source from http://www.umiacs.umd.edu/~hal/megam/index.html
1. Installed cygwin with gcc, make and ocaml packages
2. changed the makefile
3. when trying to compile megam with a makefile I receive an error with the following content
make
ocamldep *.mli *.ml > .depend
ocamlc -g -custom -o megam str.cma -cclib -lcamlstr bigarray.cma -cclib -lbigarray unix.cma -cclib -lunix -I /lib/ocaml/caml fastdot_c.c fastdot.cmo intHashtbl.cmo arry.cmo util.cmo data.cmo bitvec.cmo cg.cmo wsemlm.cmo bfgs.cmo pa.cmo perceptron.cmo radapt.cmo kernelmap.cmo abffs.cmo main.cmo
sh: flexlink: command not found
File "fastdot_c.c", line 1:
Error: Error while building custom runtime system
make: *** [Makefile:101: megam] Error 2
Do you know what the problem might be?
Maybe somebody has solved the same problem recently and could help.
As the error is
sh: flexlink: command not found
you need to find the package that contains it
$ cygcheck -p flexlink
Found 5 matches for flexlink
flexdll-0.34-1 - flexdll: Creates DLLs with runtime symbol resolution (installed binaries and support files)
flexdll-0.35-1 - flexdll: Creates DLLs with runtime symbol resolution (installed binaries and support files)
flexdll-0.35-2 - flexdll: Creates DLLs with runtime symbol resolution
...
So you need to install the flexdll package.
$ cygcheck -l flexdll |grep bin
/usr/bin/flexlink

gdal_merge.py not working after gdal and it python bindings have been installed

I installed Python 3.4.0 64 bit and gdal file release-1400-x64-gdal-1-11-1-mapserver-6-4-1.zip from http://www.gisinternals.com/release.php. I found the binding from http://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal and the filename is GDAL-1.11.2-cp34-none-win_amd64. I successfully install these files and import gdal. However, when I run the following command within the Python IDE to merge files 1 2 and 3, I got an error
>>> gdal_merge.py -o out.tif 1.tif 2.tif 3.tif
File "<console>", line 1
gdal_merge.py -o out.tif 1.tif 2.tif 3.tif
^
SyntaxError: invalid syntax
I specifically check to see if I can import gdal_merge as below
>>> import gdal_merge
and it was ok.
I appreciate if anybody could help with this issue.
gdal_merge.py is part of the GDAL utilities which are executed from the command line, not from within a Python IDE or another Python script.
Just open a command line (cmd) and type:
python gdal_merge.py -o out.tif 1.tif 2.tif 3.tif
Depending on your environment variables and whether you included GDAL in your Path variable you might need to specificy the full path to gdal_merge.py and/or can leave out python at the beginning of the call.

pip fails to install PIL or Pillow with mt.exe error

On one of my Windows 7 development machines, I am attempting to install the Python Image Library.
My machines are similar. Both run Windows 7 Professional, x64. Both use Python 2.7.3 (32bit). On one of the machine pip install PIL works fine. On the other it fails with the trace ending with this:
build\temp.win-amd64-2.7\Release\_imaging.pyd.manifest : general error c1010070:
Failed to load and parse the manifest. The system cannot find the file specified.
error: command 'mt.exe' failed with exit status 31
How can I resolve this error?
Thanks to http://bugs.python.org/issue4431, this error was fixed by modifying:
C:\<Python dir>\Lib\distutils\msvc9compiler.py
and adding:
ld_args.append('/MANIFEST')
after the MANIFESTFILE line so it looks like:
# Embedded manifests are recommended - see MSDN article titled
# "How to: Embed a Manifest Inside a C/C++ Application"
# (currently at http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx)
# Ask the linker to generate the manifest in the temp dir, so
# we can embed it later.
temp_manifest = os.path.join(
build_temp,
os.path.basename(output_filename) + ".manifest")
ld_args.append('/MANIFESTFILE:' + temp_manifest)
ld_args.append('/MANIFEST')
If you still get the error, then change the if arg.startswith("/MANIFESTFILE:") to if arg.startswith("/MANIFEST:") in the manifest_get_embed_info(self, target_desc, ld_args) method.
Download the compressed package from pypi, and try building and installing in your machine. This link could give you some hints. That exactly deals with your problem only but the installation varies.
If you've reached here looking for
general error c1010070:
Failed to load and parse the manifest. The system cannot find the file specified.
error: command 'mt.exe' failed with exit status 31
Here's a workaround that worked in Windows 8/x64/Python 3.3/VS 11:
# py 3.3 seems to be compiled against VS 2010 compiler, force using VS11 cl.exe for us
$env:VS100COMNTOOLS=$env:VS110COMNTOOLS
# Modify C:\Python33\lib\distutils\msvc9compiler.py
# Comment line 670: ld_args.append('/MANIFESTFILE:' + temp_manifest)
# Basically it will instruct build to not look for manifest file

Categories