Skip to content

Instantly share code, notes, and snippets.

@justin2004
Created December 20, 2021 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justin2004/043eaf7ed18f81dd1b20cb5d64b94910 to your computer and use it in GitHub Desktop.
Save justin2004/043eaf7ed18f81dd1b20cb5d64b94910 to your computer and use it in GitHub Desktop.
python nltk from clojure -- error
root@parens:/mnt# cat project.clj
(defproject nltk-work "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[clj-python/libpython-clj "2.003"]
[org.clojure/clojure "1.10.0"]]
:repl-options {:init-ns nltk-work.core})
...
root@parens:/mnt# pip3 install nltk numpy
Requirement already satisfied: nltk in /usr/local/lib/python3.7/dist-packages (3.6.5)
Requirement already satisfied: numpy in /usr/local/lib/python3.7/dist-packages (1.21.5)
Requirement already satisfied: click in /usr/local/lib/python3.7/dist-packages (from nltk) (8.0.3)
Requirement already satisfied: tqdm in /usr/local/lib/python3.7/dist-packages (from nltk) (4.62.3)
Requirement already satisfied: regex>=2021.8.3 in /usr/local/lib/python3.7/dist-packages (from nltk) (2021.11.10)
Requirement already satisfied: joblib in /usr/local/lib/python3.7/dist-packages (from nltk) (1.1.0)
Requirement already satisfied: importlib-metadata; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from click->nltk) (4.10.0)
Requirement already satisfied: typing-extensions>=3.6.4; python_version < "3.8" in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->click->nltk) (4.0.1)
Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.7/dist-packages (from importlib-metadata; python_version < "3.8"->click->nltk) (3.6.0)
root@parens:/mnt# lein repl
Retrieving nrepl/nrepl/0.6.0/nrepl-0.6.0.jar from clojars
...
nREPL server started on port 37005 on host 127.0.0.1 - nrepl://127.0.0.1:37005
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.10.0
OpenJDK 64-Bit Server VM 11.0.12+7-post-Debian-2deb10u1
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
nltk-work.core=> (ns nltk-work.core
#_=> (:require [libpython-clj2.require :refer [require-python]]
#_=> [libpython-clj2.python :as py :refer [py. py.. py.-]]))
nil
nltk-work.core=> (require-python '[numpy :as np])
:ok
nltk-work.core=> (np/array [[1 2] [3 4 ]])
[[1 2]
[3 4]]
nltk-work.core=> (require-python '([nltk :as nltk]))
:ok
nltk-work.core=> (nltk/download "book")
Syntax error compiling at (form-init16745626044693851632.clj:1:1).
No such namespace: nltk
nltk-work.core=>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment