I am working with Hidden Markov Models in Python. For that I came across a package/module named hmmpytk. The problem is hmmpytk isnt pre-installed and when I download the hmmpytk module, i only get codes without the installation file. I use windows operating system. If I run a code simply with "from hmmpytk import hmm_faster" I get an Import error. ..so no idea how i get started with hmmpytk.
Asked
Active
Viewed 1,944 times
-2
-
I would copy the source to site-packages – David Heffernan Feb 10 '14 at 22:10
2 Answers
0
You probably want PIP or easy_install to install python packages.

gabe
- 2,521
- 2
- 25
- 37
-
I don't think this package is available on PyPI, and it also doesn't come with the `setup.py` file, so `distribute` can't be used. – darthbith Feb 10 '14 at 21:56
-
0
You need to make sure that the folder hmmpytk
(and possibly also lame_tagger
) is "in the directory containing the script that was used to invoke the Python interpreter." See the documentation about the Python path sys.path
EDIT: Alternatively, you can make sure that those folders are on your Python path. To see the folders in your path, type import sys; sys.path
- the CWD is the first entry in the path if you started the interactive interpreter.

darthbith
- 18,484
- 9
- 60
- 76
-
-
Because the CWD is on the Python path, `import sys; sys.path` shows `['', ...]` where the empty string indicates the CWD. See [the docs](http://docs.python.org/2/library/sys.html#sys.path). – darthbith Feb 10 '14 at 21:58
-
Ok. Is that how you recommend installing packages? Put them all in your working directory? – David Heffernan Feb 10 '14 at 22:03
-
No, probably not. But this package doesn't include the "standard" method of installing (`setup.py` etc.), so depending on your needs, it might be easiest to keep it in the working directory. Really though, you can put it anywhere on the path. See my edit. And thanks for getting me to think about it :-) – darthbith Feb 10 '14 at 22:07
-
You read the docs wrong. Read them again. As I alluded to, working directory is never searched. Its the directory containing the script used to invoke the interpret or that matters. This answer is both wrong and contains bad advice. – David Heffernan Feb 10 '14 at 22:09
-
The docs say: "if the interpreter is invoked interactively or if the script is read from standard input), path[0] is the empty string, which directs Python to search modules in the current directory first" - thus, if the interactive interpreter is started, the answer is perfectly correct. The OP never specified their use case. And anyways, my edit suggests you can put the files anywhere on the path, advice you gave to the OP in your own comment... – darthbith Feb 10 '14 at 22:12
-
You could just edit your answer to remove all reference to working directory and replace with directory containing script used to invoke interpreter. And then I could delete comments. – David Heffernan Feb 10 '14 at 22:14
-
"directory containing script used to invoke interpreter" Isn't that the definition of "current working directory" to the Python interpreter, interactive or not? Nonetheless, made the edit. Could you leave the comments so the edit chain makes sense? – darthbith Feb 10 '14 at 22:23
-
No it is not. For instance consider `python somedir/script.py` – David Heffernan Feb 10 '14 at 22:29
-
In that case, I would expect Python's current working directory to be `somedir` - and printing `sys.path` in that example lists `/path/to/somedir` as the first entry. I still don't understand your objection... – darthbith Feb 10 '14 at 22:36
-
`import os; print os.getcwd()` prints `/path/to`, so I understand the distinction. Thanks for the correction. – darthbith Feb 10 '14 at 22:43
-
It's really important. So often that dir happens to be the same as the working dir. And so you can make this error but get away with it. Eventually it will bite you. Thanks for listening. – David Heffernan Feb 10 '14 at 22:46