Why does my Clojure import fail? - clojure

I'm running Clojure 1.3 with contrib 1.1 in IntelliJ. My program consists of a single line
(use 'clojure.contrib.prxml)
I get the following error upon running
Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchMethodError: clojure.lang.RestFn.<init>(I)V

I'm running Clojure 1.3 with contrib 1.1
There's your problem. Clojure and contrib versions are linked against each other, and are not compatible across versions.
Even more, contrib has been split up into lots of smaller libraries as of 1.3, so there is really no version of "monolithic contrib" that you can use with 1.3.

In addition to the answers saying that contrib 1.1 is incompatible with clojure 1.3
Taken from here:
Versions of clojure-contrib are matched to versions of Clojure.
If you are using Clojure 1.0, use clojure-contrib 1.0.
If you are using Clojure 1.1, use clojure-contrib 1.1.
If you are using Clojure 1.2, use clojure-contrib 1.2, or the new modular Contrib libraries.
If you are using Clojure 1.3, use the new modular Contrib libraries.
As of the date of this reply I'm not sure if there is a version of clojure.contrib.prxml that is compatible with clojure-1.3 (Someone please correct me if I'm wrong).
So I would suggest using clojure-1.2.1 and clojure-contrib 1.2.0.

Nothing is wrong with the call works with clojure 1.2 and contrib 1.2
If you don't need anything 1.3 specific I would suggest sticking to 1.2 for the time being, use clojure 1.2 and contrib 1.2 until contrib authors properly make the transition to 1.3

Related

Cannot use Clojure 1.7 with Leiningen

Using Leiningen, I'm unable to use Clojure 1.7 in project, but I am able to use later versions.
For instance, if I clone down the Om Next Tutorial and try to run it, I get a java.lang.NoClassDefFoundError: clojure/lang/Tuple. Full stack trace here. A similar error occurs any time I try to use Clojure 1.7 in a project with Leiningen.
However, the error goes away if I upgrade to Clojure 1.8 or 1.9 in project.clj. The trouble is that I'm not always in a position to upgrade the version on a project.
Versions installed:
Clojure: 1.8.0
Java: OpenJDK 1.8.0_171
Leiningen: 2.8.1
Ubuntu: 16.04 LTS
The problem happens with or without my lien profiles.clj.
I'm not a Java expert, but this looks like a classpath issue to me. I am using update-java-alternatives to set the path to Java 1.8.
Edit: I created a minimal repo that reproduced the problem, using the very first part of the Om Next tutorial, here.

Choosing the appropriate version of Python runtime to use along with TensorFlow

How can I choose the appropriate version of Python runtime to use along with TensorFlow 1.0 ?
I would invite you to check the TensorFlow installation page which gives all the detail for your specific system. At the moment, TensorFlow supports Python 2.7, 3.4, 3.5, 3.6, although it seems 3.6 does not yet have GPU support. If you're starting out with Python, you should probably get 3.5 (if you need GPU) or 3.6 (if you'll only use CPU). Python 2.7 was released a long time ago.
If you don't already have Python, you can get it from the Python website. However, I recommend you get Python through Anaconda so that you get all necessary packages to run things like TensorFlow.

Django 1.5 : Python 2.7 or Python 3

Django just release their 1.5 version.
It now supports Python 3, my question is quite simple indeed: With this 1.5 Version, should I still use Python 2.7 or Python 3 ? I assume that with Python 3 there will be some issues with 3rd parties app no ?
In your case, what would you do ?
The release notes state clearly that Python 3 support in 1.5 is experimental. And yes, third-party apps will be a problem.
If I was starting a new development which I didn't expect to go live until well after version 1.6 is released (when Python 3 support is supposed to be production ready, and hopefully the 3rd party apps have caught up) , then yes, I would go with Python 3. It is significantly cleaner than Python 2.7.
But if you want your site up and running in the near future, stick with 2.7.
I would still use python 2.7 because many apps and libraries are not ready for python 3.x
PIL is not working correctly with python 3

How do I install Clojure 1.3 with contribs on RHEL 6.1 / JDK7?

I've been struggling a bit trying to get this to work. Getting clojure 1.3 was a breeze, but now I've been trying to get contrib libraries to install and I get errors. Is there a guide on how to do this correctly?
The old clojure.contrib monolithic library is incompatible with clojure 1.3. See http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
As for how to install libraries correctly, either write your own pom.xml and use maven or use leiningen (much easier!) - https://github.com/technomancy/leiningen

Are there any Python template engines that support Python 3.x

It seems they all run on Python 2.x.
(Actually I want a more widely-used engine that has Python 3.x support.)
Just released Jinja 2.3 has experimental support for Python 3. http://lucumr.pocoo.org/2010/2/10/jinja-2-3-released
If you don't mind using beta software, the newly-released moody-templates was written for Python 3 from the ground up.
https://github.com/etianen/moody-templates
Maybe very outdated, but Mako supports python 3.
The first search result is the templating wiki page; which includes at least one templating engine which says it works on Python 2.4, 2.5, 2.6 and 3.0.