include sympy library into chaquo - sympy

include sympy python packages into Chaquopy:
I started with the example python provided by Chaquopy available at github (https://github.com/chaquo/chaquopy) for Android studio 3.0.1.
Than I created 2 wheel files from the sympy source () files, based on python 3.6.3, see the below files that wheel generated:
"mpmath-1.0.0-py3-none-any.whl"
"sympy-1.1.1-py3-none-any.whl"
I tried to install the above files into the build.gradle of the demo example from 1., for testing purposes I tried some of there own wheel files (that process succeeded), but could not install my own wheel files.
I am fairly certain that the local wheel files that I generated are placed in the proper directory, because if I change the directory in the gradle file it complains that it cannot find the file.
I included the wheel files in the build.gradle(Module:app) file as follows:
python {
// Enable and edit the following line if "python" is not on your PATH.
// buildPython "C:/Python27/python.exe"
version "3.6.3"
// Android UI demo
pip {
install "Pygments==2.2.0" // Also used in Java API demo
}
pip {
install "wheels/mpmath-1.0.0-py3-none-any.whl"
// install "wheels/sympy-1.1.1-py3-none-any.whl"
// install "numpy==1.9.2"
// install "numpy==1.14.0"
}
When created the build gradle generates the following error:
sympy-1.1.1-py3-none-any.whl is not a supported wheel on this platform.
Exit status 1
:app:generatePy2DebugPythonRequirements FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:generatePy2DebugPythonRequirements'.
Process 'command 'python'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 2s
7 actionable tasks: 1 executed, 6 up-to-date
Does anyone have an idea what could be wrong?

sympy and mpmath have now been added to the Chaquopy wheel repository (https://github.com/chaquo/chaquopy/issues/20), so you don't need to build your own anymore.

Did some further investigation and did see that I somehow compiled for Py2, while my wheel files where version 3 changing this resulted in a correct executable.
It did run into a different issue, while the mpmath module could be imported into the interactive python console (part of the demo app), the sympy module gave an error:
ModuleNotFoundError: no module named 'distutils'
Let me know if anyone ran into a similar problem!

Related

Pabot - Unable to run parallel robotframework tests

So, I'm working on a robotframework test project, and the goal is to run several test suites in parallel. For this purpose, pabot was chosen as the solution. I am trying to implement it, but with little success.
My issue is: after installing Pabot (which, I might say, I did by cloning the project and running "setup.py install", instead of using pip, since the corporate proxy I'm behind has proven an obstacle I can't overcome), I created a new directory in the project tree, moved some suites there, and ran:
pabot --processes 2 --outputdir pabot_results Login*.robot
Doing so results in the following error message:
2018-10-10 10:27:30.449000 [PID:9676] [0] EXECUTING Suites.LoginAdmin
2018-10-10 10:27:30.449000 PID:400 EXECUTING Suites.LoginUser
2018-10-10 10:27:30.777000 PID:400 FAILED Suites.LoginUser
2018-10-10 10:27:30.777000 [PID:9676] [0] FAILED Suites.LoginAdmin
WARN: No output files in "pabot_results\pabot_results"
Output:
[ ERROR ] Reading XML source '' failed: invalid mode ('rb') or filename
Try --help for usage information.
Elapsed time: 0 minutes 0.578 seconds
Upon inspecting the stderr file that was generated, I have this message:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\robotframework-3.1a2.dev1-py2.7.egg\robot\running\runner.py", line 22, in
from .context import EXECUTION_CONTEXTS
ValueError: Attempted relative import in non-package
Apparently, this has to do with something from the runner.py script, which, if I'm not mistaken, came with the installation of robotframework. Since manually modifying that script does not seem to me the optimal solution, my question is, what am I missing here? Did I forget to do anything while setting this up? Or is this an issue of compatibility between versions?
This project is using Maven as the tool to manage dependencies. The version I am running is 3.5.4. I am using a Windows 10, 64bit system; I have Python 2.7.14, and Robot Framework 3.1a2.dev1. The Pabot version is 0.44. Obviously, I added C:\Python27 and C:\Python27\Scripts to the PATH environment variable.
Edit: I am also using robotframework-maven-plugin version 1.4.0.8, if that happens to be relevant.
Edit 2: added the error messages in text format.
I believe I've come across an issue similar when setting up parallel execution on my machine. Firstly I would confirm that pabot is installed using pip show robotframework-pabot.
Then you should define the directory your results are going to using -d.
I then modified the name of the -o to Output.xml to make it easy to identify.
This is a copy of the code I use. Runs optimally with 8 processes
pabot --processes 8 -d results -o Output.xml Tests
Seems that you stumbled on a bug in the prerelease version of robot framework (3.1a2.dev1).
Please install a release version of robot framework. For example 3.0.4.
Just in case anyone happens to stumble upon this issue in the future:
Since I can't use pip, and I tried a good deal of workarounds that eventually made things more unstable, I ended up saving my project and removing everything Python-related from my system, so as to allow me to install everything from scratch. In a Windows 10, 64bit system, I used:
Python 2.7.14
wxPython 2.8.12.1, win64, unicode, for py27
setuptools 40.2.0 (to allow me to use the easy_install command)
Robot Framework 3.0.4
robotremoteserver 1.1
Selenium2Library 3.0.0
and Pabot version 0.45.
I might add that, when installing the Selenium2Library the way I described above, it eventually tries to download some things from the pip repositories - which, if you have a proxy, will cause you trouble. I solved this problem by browsing https://pypi.org/simple/selenium/, manually downloading the 2.53.6 .tar.gz file, then extracting it and running setup.py install on the command line.
PS: Ideally, though, anyone should be able to use proxy settings from the command line (--proxy http://user:password#server:port) to get pip and then use it; however, for some reason, probably related to network security configurations that I didn't want to lose time with, this didn't work in my case.

Error after installing Anaconda 2: Fatal Python error: Py_Initialize: unable to load the file system codec

When trying to run a program in python from the terminal I get the following error:
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
Current thread 0x00007fffb68a93c0 (most recent call first):
Abort trap: 6
I am currently running Python 3.6.4 :: Anaconda custom (64-bit) and think this problem may have to do with also having Anaconda 2 installed. Could someone help me figure out what the cause is and how I can remedy this?
I'd also be interested in knowing more tips about how to use Anaconda 2 and 3 concurrently so that this doesn't happen again.
After some trouble shooting w/ you, it looks like reinstalling anaconda (from the version 3.6 choice on the web) crossed some wires.
For others either...
1) Use your original installment and make a python3 environment. To do this change your .bash_profile to only include
export PATH="/Users/<username>/anaconda2/bin:$PATH
and perhaps remove or move the
/Users/<username>/anaconda3
directory to a new name. Then make a new environment using the original anaconda(with python version 2) that fetches and uses Python 3.6:
conda create -n mypython3environment python=3.6
where "mypython3environment" is some name you want when you use python 3.6
then to use it in your project - go to your project's directory and type:
source activate mypython3environment
2) Do a clean install. The other option is to cut out the anaconda stuff from your .bash_profile, remove or move the anaconda2/ and anaconda3 directories and the .bash_profile.pysave file and try to reinstall from the anaconda webpage.
Overall - you need to install anaconda once - then use conda create and source activate <environment name> to make then use environments, respectively, with your Python version of choice, whether it is a Python 2 or 3 version.
See Anaconda's Managing Environments and the cheatsheet

Flatpak (flatpak-build) fatal error when building submodules

Following on from here, when using OpenSUSE Tumbleweed I cannot get flatpak-builder to compile submodule dependencies. I first noticed this issue when developing a console application within Gnome Builder using the Vala dependencies Gee and GXml.
As a test, I have installed org.gnome.Books.json and issued the following command (as documented here):
$ flatpak-builder --repo=repo books-app org.gnome.Books.json
The outcome is the same as I observed when developing my own application, the fatal error:
Initializing build dir
Committing stage init to cache
Starting build of org.gnome.Books
fuse: failed to exec fusermount: Permission denied
<more stuff>
Cloning into '/home/robin/Projects-CSim/org.gnome.books/.flatpak-builder/build/gnome-online-accounts-1/telepathy-account-widgets'...
Submodule path 'telepathy-account-widgets': checked out '7d944b79961dfb6291110ceb27597a224d329b36'
error: Build directory /home/<user>/Projects/org.gnome.books/.flatpak-builder/rofiles/rofiles-D4R4cZ not initialized, use flatpak build-init
Error: module gnome-online-accounts: module gnome-online-accounts: Child process exited with code 1
Effectively it fails to build the very first submodule. This is the same behaviour that I observed when invoked from Gnome-Builder on my project; it downloaded but failed to build the very first submodule - in that case it was libgee-0.8.
I've double checked the Flatpak (V0.10.4) installation here and cannot find a solution. I understand from the documentation that invoking flatpak-builder should automatically invoke flatpak build-init.
This is worrisome as Gnome-Builder seems be using Flatpak as the default packager. Any suggestions?
The problem is not Flatpak. It is a conflict between Flatpak and fuse. For some reason this was not occuring with valac or meson from the command line, only Flatpak.
From here we find a solution:
# chmod +x /usr/bin/fusermount
Is this a peculiarity of OpenSUSE Tumbleweed? In any case, after making this change, Flatpak builds submodules as expected. Magnificent!
Not sure about the security aspect of this, however - any comments would be welcomed.

post install dependencies order in spec files

Is it possible to post install Requires dependecies in a spec file on Centos /RHEL 7?
I tried Requires: somepackage = 1.0.0.0
The problem is that I need to run a script prior to the dependencies being installed.
I tried to run that in the %pre section but it appears that it's not executed before the requires' %pre section is run and failing due to a missing license file.
The spec file looks like this:
Name: MyClient
Requires: MyServerPackage = 1.0.0.0
%pre
echo "Write license that is needed by MyServerPackage prior to install" > /tmp/mylicense
The problem is that I get an error: %pre(MyServerPackage) scriptles failed, exit status 1
Because the /tmp/mylicense is not there at the time MyServerPackages %pre script runs.
I've also tried to add a package called mylicense and adding a PreReq: mylicense. But no matter what I try I get that error from the check in MyServerPackage %pre.
I need to run a script prior to the dependencies being installed.
That's impossible; the dependency might have been installed two years ago, for all you know.
To answer where I think you're going, you can specify that something is required for a specific section with:
Requires: MyServerPackage
Requires(pre,preun): MyServerPackage
This would tell it (line 1) that to be installed, MyServerPackage should always be there. Then line 2 explicitly says it should be there before installing or attempting to uninstall this package if you're installing them at the same time. This is useful if, for example, the other package sets up a user name, etc.

Can't install Bioperl Module (properly?)

I am not able to install a BioPerl Module via cpanm. With
sudo cpanm Bio::SeqIO
The output says:
--> Working on Bio::SeqIO
Fetching http://www.cpan.org/authors/id/C/CJ/CJFIELDS/BioPerl-1.6.922.tar.gz ... OK
Configuring BioPerl-1.006922 ... OK
Building and testing BioPerl-1.006922 ... FAIL
! Installing Bio::SeqIO failed. See /home/administrator/.cpanm/work/1398677477.16274/build.log for details. Retry with --force to force install it.
When adding --force it says:
--> Working on Bio::SeqIO
Fetching http://www.cpan.org/authors/id/C/CJ/CJFIELDS/BioPerl-1.6.922.tar.gz ... OK
Configuring BioPerl-1.006922 ... OK
Building and testing BioPerl-1.006922 ... FAIL
! Testing BioPerl-1.006922 failed but installing it anyway.
Successfully installed BioPerl-1.006922
1 distribution installed
So I am not sure whether I can use BioPerl now properly? Can I simply ignore that the testing failed?
I have already tried to reinstall CPAN with
o conf init
in the CPAN prompt, but the outcome was the same. I am working with Perl V5.14.2 and cpanm -v brings me:
cpanm (App::cpanminus) 1.6933 on perl 5.014002 built for x86_64-linux-gnu-thread-multi
Work directory is /home/administrator/.cpanm/work/1398677790.16651
You have make /usr/bin/make
You have LWP 6.05
You have /bin/tar: tar (GNU tar) 1.26
I am happy with any help, since I am a totally Linux newbie.
BioPerl uses many modules that you might not have installed. From BioPerl INSTALL file:
Remember that there are over 900 modules in BioPerl and the test
suite is running more than 12000 individual tests, a few failed tests
may not affect your usage of BioPerl
Most of the time you will not need these additional modules depending on what modules within BioPerl you are using. I'm sure that BioPerl has installed correctly on you system. I would work through http://www.bioperl.org/wiki/HOWTO:Beginners to learn BioPerl. If you get errors running these basic codes in the HOWTO, repost another question.
Good luck,
Paul