0

I'm trying to run a script to perform biterm topic modeling (BTM) (can be found here: https://github.com/xiaohuiyan/BTM). The code contains a runnable example, which can be executed via the following:

$ cd script
$ sh runExample.sh

I get an error message that reads:

=============== Index Docs =============
  File "indexDocs.py", line 18
    print(' '.join(map(str, wids)), file=wf)
                                        ^
SyntaxError: invalid syntax
=============== Topic Learning =============
runExample.sh: line 28: ../output/voca.txt: No such file or directory
g++  -c -pipe -O3 model.cpp -o model.o 
g++  -c -pipe -O3 infer.cpp -o infer.o 
g++  -c -pipe -O3 main.cpp -o main.o 
g++ model.o infer.o main.o -o btm
../src/btm est 20  2.500 0.005 5 501 ../output/doc_wids.txt ../output/model/
runExample.sh: line 31: 51872 Segmentation fault: 11  ../src/btm est $K $W $alpha $beta $niter $save_step $dwid_pt $model_dir
================ Infer P(z|d)===============
../src/btm inf sum_b 20 ../output/doc_wids.txt ../output/model/
Run inference:K=20, type sum_b ====
load p(z):../output/model/k20.pz
[Error] file not find:../output/model/k20.pz
================ Topic Display =============
Traceback (most recent call last):

I'm guessing that this is simply me using the wrong version of Python. If so, how do I change the version of Python that I am using? Or if this is an actual recognizable error in the code how do I correct it?

3
  • we didn't see your script. Why not prefixing the python script by the required python version executable? Commented Jan 14, 2018 at 21:55
  • You could choose python version using python2 or python3 in script file. However the error seems like there is a path problem not about python version. Commented Jan 14, 2018 at 21:57
  • 1
    I don't think this has anything to do with python versions. It simply appears that your script is unable to find the file you want to write to. Is indexDocs.py a program that you wrot? Commented Jan 14, 2018 at 22:00

2 Answers 2

1

From the error it seems like some file k20.pz is missing and not python version.

Check if your machine had all the folders mentioned in path /output/model/k20.pz

But for your python version question here is what you could do...

Let’s say you have installed 2 versions of python on your machine. They will be installed on different paths. You can find the path by using find command at C: prompt (windows) or root (Mac)

find . -name python.exe

You can then use specific version of python by using the absolute path to desired version of python.

If you have preference on only one version of python that either add the absolute path to PATH environment variable for windows or add it to PATH variable in profile for MAC

Sign up to request clarification or add additional context in comments.

Comments

0

The error message clearly states that a file cannot be found:

file not find:../output/model/k20.pz

This does not appear to have anything to do with the python version. Check that each of the folders in this path exist.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.