Can't load batteries using FindLib in Ocaml TopLevel - functional-programming

I successfully installed ocaml-batteries-included and findlib.
I can do 'ocamlfind ocamlc -package batteries -c mycode.ml` without problems.
Also, if I do ocamlfind list, I get
$ ocamlfind list
batteries (version: 2.0)
batteries.pa_comprehension (version: 2.0)
batteries.pa_comprehension.syntax (version: 2.0)
batteries.pa_llist (version: 2.0)
batteries.pa_llist.syntax (version: 2.0)
batteries.pa_string (version: 2.0)
batteries.pa_string.syntax (version: 2.0)
batteries.syntax (version: 2.0)
bigarray (version: [distributed with Ocaml])
camlp4 (version: [distributed with Ocaml])
...
The problem is using batteries in ocaml (toplevel).
I have set up .ocamlinit as told:
#use "topfind";;
Toploop.use_silently
Format.err_formatter (Filename.concat (Findlib.package_directory
"batteries") "battop.ml");;
but when I launch ocaml, I get this:
$ ocaml
OCaml version 4.00.1
Findlib has been successfully loaded. Additional directives:
#require "package";; to load a package
#list;; to list the available packages
#camlp4o;; to load camlp4 (standard syntax)
#camlp4r;; to load camlp4 (revised syntax)
#predicates "p,q,...";; to set these predicates
Topfind.reset();; to force that packages will be reloaded
#thread;; to enable threads
Exception: Fl_package_base.No_such_package ("batteries", "").
Further, if I do #list in ocaml toplevel, I get
# #list;;
bigarray (version: [distributed with Ocaml])
camlp4 (version: [distributed with Ocaml])
camlp4.exceptiontracer (version: [distributed with Ocaml])
camlp4.extend (version: [distributed with Ocaml])
...
I can't see batteries package.
What's the problem?

Is there a reason why you're not using OPAM? (https://github.com/OCamlPro/opam)
Install OPAM, switch to your favorite version of the 4.0x compiler (for example opam switch 4.00.1), and run: opam install batteries. I recommend doing opam install utop and using utop instead of the vanilla toplevel. In either case:
Put the following in your ~/.ocamlinit
#use "topfind";;
#require "batteries";;
open Batteries;;
This is all you need to get batteries working.

Related

'MSIAuthentication' object has no attribute 'get_token'

On Azure ML Workspace Notebook, I'm trying to get my workspace instance, as seen at
https://learn.microsoft.com/en-us/azure/machine-learning/tutorial-auto-train-models#configure-workspace.
I have a config file and I am running the notebook in an Azure compute instance.
I tried to execute Workspace.from_config().
As a result, I'm getting the 'MSIAuthentication' object has no attribute 'get_token' error.
I tried to submit both MsiAuthentication and InteractiveLoginAuthentication, as suggested in
https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/manage-azureml-service/authentication-in-azureml/authentication-in-azureml.ipynb.
There are 2 solutions I've found:
1.- Use the kernel "Python 3.6 - AzureML"
2.- pip install azureml-core --upgrade
This will upgrade
azureml-core to 1.32.0
But will downgrade:
azure-mgmt-resource to 13.0.0 (was 18.0.0)
azure-mgmt-storage down to 11.2.0 (was 18.0.0)
urllib3 to 1.26.5 (was 1.26.6)
This upgrade / downgrade allows the same package versions as in the python 3.6 anaconda install

Error NU1202 Package Microsoft.Data.Sqlite.Core 2.0.0 is not compatible with uap10.0.14393 (UAP,Version=v10.0.14393) / win10-x64.

I've downloaded a working UWP solution targeting 16299 which I changed to target 14393 (Anniversary) so it would work on all Windows 10 Phones as well. Apart from the obvious errors where the solution uses newer W10 version methods and namespaces, I also get:
Error NU1202 Package Microsoft.Data.Sqlite.Core 2.0.0 is not compatible with uap10.0.14393 (UAP,Version=v10.0.14393) / win10-x64. (multiple times)
But according to https://blogs.windows.com/buildingapps/2017/02/06/using-sqlite-databases-uwp-apps/ Microsoft SQLite should work from 14393.
I've tried installing the oldest version number available (2.0.0 instaed of 2.1.0 now included) but that doesn't change the error.
How can I solve this problem?
Dick
sqlite.core is the core version and will work only from fall creators update and above. if you want to use sqlite on older versions then you can see details here : https://learn.microsoft.com/en-us/windows/uwp/data-access/sqlite-databases

JavaFx installaion returns Cannot perform operation. Computing alternate solutions, may take a while: 15/15

I am using
Windows 7 Ultimate edition
Java 10.0.2
Eclipse OXYGEN.3A (April 2018) Version: Oxygen.3a Release (4.7.3a)
When I try to install the JavaFx from the location http://download.eclipse.org/efxclipse/updates-released/1.2.0/site/
then I got the following
Cannot perform operation. Computing alternate solutions, may take a while: 15/15
Cannot complete the install because one or more required items could not be found.
Software being installed: e(fx)clipse - IDE - PDE 1.2.0.201501301049 (org.eclipse.fx.ide.pde.feature.feature.group 1.2.0.201501301049)
Missing requirement: JDT UI Tooling for JavaFX 1.2.0.201501301049 (org.eclipse.fx.ide.jdt.ui 1.2.0.201501301049) requires 'bundle org.eclipse.xtext.xbase.lib 2.7.1' but it could not be found
Cannot satisfy dependency:
From: e(fx)clipse - IDE - Basic 1.2.0.201501301049 (org.eclipse.fx.ide.basic.feature.feature.group 1.2.0.201501301049)
To: org.eclipse.fx.ide.jdt.ui [1.2.0.201501301049]
Cannot satisfy dependency:
From: e(fx)clipse - IDE - PDE 1.2.0.201501301049 (org.eclipse.fx.ide.pde.feature.feature.group 1.2.0.201501301049)
To: org.eclipse.fx.ide.basic.feature.feature.group 0.0.0
What requirement am I missing.
You do unterstand, that the version of e(fx)clipse you're attempting to install is basically years old!
For example check here - the updates-released section shows versions up to 3.3.0 with a fairly recent date feature_3.3.0.201805280700.
So either use this or use the marketplace entry (which seem to point to version 3.0.0) - drag and drop the install button into your running Eclipse instance or use the marketplace from within Eclipse itself (Help menu, as far as I recall or installable) and search for efxclipse.

Can't open Llvm in ocaml

I'm trying to use llvm binding in ocaml, in my file test.ml, I have one line of code:
open Llvm
When I run the command
ocamlbuild -use-ocamlfind test.byte -package llvm
I get this result:
+ ocamlfind ocamldep -package llvm -modules test.ml > test.ml.depends
ocamlfind: Package `llvm' not found
Command exited with code 2.
Compilation unsuccessful after building 1 target (0 cached) in 00:00:00.
What did I do wrong in this? Thanks.
BTW, the _tag file contains:
"src": traverse
<src/{lexer,parser}.ml>: use_camlp4, pp(camlp4of)
<*.{byte,native}>: g++, use_llvm, use_llvm_analysis
myocamlbuild.ml contains:
open Ocamlbuild_plugin;;
ocaml_lib ~extern:true "llvm";;
ocaml_lib ~extern:true "llvm_analysis";;
flag ["link"; "ocaml"; "g++"] (S[A"-cc"; A"g++"]);;
I don't know why the instructions that you're using are so complex. You don't have to do anything like this to use llvm bindings in OCaml, provided you have installed them via opam.
Here is the recipe:
Install llvm bindings via opam.
it could be as simple as
opam install llvm
However, opam may try to install the latest version that is not available on your system, so pick a particular version, that you have and do the following (suppose you have llvm-3.8):
opam install conf-llvm.3.8
opam install llvm --criteria=-changed
(The -criteria flag will prevent opam from upgrading conf-llvm to the newest version)
Once it succeeds, you can easily compile your programs without any additional scaffolding.
Create and build your project
create a fresh new folder, e.g.,
mkdir llvm-project
cd llvm-project
create a sample application (borrowed from some tutorial, that I've found online):
cat >test.ml<<EOF
open Llvm
let _ =
let llctx = Llvm.global_context () in
let llmem = Llvm.MemoryBuffer.of_file Sys.argv.(1) in
let llm = Llvm_bitreader.parse_bitcode llctx llmem in
Llvm.dump_module llm ;
()
EOF
compile it for bytecode
ocamlbuild -pkgs llvm,llvm.bitreader test.byte
or to the native code
ocamlbuild -pkgs llvm,llvm.bitreader test.native
run it
./test.native mycode.bc

Plone ZMySQLDA, Couldn't install MySQL-python 1.2.4c1 with buildout

I want to use mysql form ploneformgen, but I
Can't buildout plone.
buildout log http://pastie.org/5345272.js
Getting required 'MySQL-python>=1.2.1'
required by Products.ZMySQLDA 3.1.1.
We have no distributions for MySQL-python that satisfies 'MySQL-python>=1.2.1'.
Getting distribution for 'MySQL-python>=1.2.1'.
Running easy_install:
/usr/local/Plone/Python-2.6/bin/python "-c" "from setuptools.command.easy_install import main; main()" "-mUNxd" "/usr/local/Plone/zeocluster/../buildout-cache/eggs/tmpDSODu0" "-Z" "/usr/local/Plone/buildout-cache/downloads/dist/MySQL-python-1.2.4c1.zip"
path=/usr/local/Plone/buildout-cache/eggs/distribute-0.6.21-py2.6.egg
Processing MySQL-python-1.2.4c1.zip
Running MySQL-python-1.2.4c1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-gFbWLf/MySQL-python-1.2.4c1/egg-dist-tmp-16g1TE
The required version of distribute (>=0.6.28) is not available,
and can't be installed while this script is running. Please
install a more recent version first, using
'easy_install -U distribute'.
(Currently using distribute 0.6.19 (/usr/local/Plone/Python-2.6/lib/python2.6/site-packages/distribute-0.6.19-py2.6.egg))
error: Setup script exited with 2
An error occured when trying to install MySQL-python 1.2.4c1. Look above this message for any errors that were output by easy_install.
While:
Installing client1.
Getting distribution for 'MySQL-python>=1.2.1'.
Error: Couldn't install: MySQL-python 1.2.4c1
*************** PICKED VERSIONS ****************
[versions]
Products.PloneFormGen = 1.7.1
Products.ZMySQLDA = 3.1.1
collective.classifieds = 1.6
plone.app.ldap = 1.2.8
quintagroup.dropdownmenu = 1.2.5
quintagroup.pfg.captcha = 1.0.5
zettwerk.ui = 1.1.1
buildout conf http://pastie.org/5345300
some links:
http://blog.mysqlboy.com/2010/08/installing-mysqldb-python-module.html
http://plone.293351.n2.nabble.com/Plone-amp-MySQL-No-quot-Z-MYSQL-Database-Connection-quot-from-ZMI-td5487160.html
It appears the MySQLdb egg requires a newer version of distribute:
The required version of distribute (>=0.6.28) is not available,
and
(Currently using distribute 0.6.19 (/usr/local/Plone/Python-2.6/lib/python2.6/site-packages/distribute-0.6.19-py2.6.egg))
Upgrade your distribute egg first; if you are using the unified installer, for example, versions.cfg pins the version. If so, edit versions.cfg to correct the version number there:
[versions]
...
# Buildout infrastructure
...
distribute = 0.6.28
While you have a perfectly good answer for the specific problem, I highly recommend forgetting about ZMySQLDA and use SQLAlchemyDA which gives you access to any database supported by SQLAlchemy (I've used all of MySQL, PostGreSQL, Oracle, SQLServer) with a single product, and is better supported.

Resources