user2179347
user2179347

Reputation: 165

ImportError: No module named stack

I have a code in python that I have been working on and it builds and runs very well on my pc (Windows). I had to run the same code on my other machine which runs ubuntu,so I had to install all the packages on prior to runing the code. The problem is I ran into this error which I couldn't figure out. The error is triggered by one of the installed packages.

    from qalsadi import analex
  File "/usr/local/lib/python2.7/dist-packages/qalsadi/analex.py", line 14, in <module>
    import pyarabic.araby as araby  # basic arabic text functions
  File "/usr/local/lib/python2.7/dist-packages/pyarabic/araby.py", line 28, in <module>
    from stack import *
ImportError: No module named stack

I used the following command, "sudo pip install pyarabic", to install it. However, still the file stack.py doesn't exist among it's files. I searched in the folder /usr/local/lib/python2.7/dist-packages/pyarabic. The folder contains the following: araby.py and init.py and the coresponding pyc files only. I'v insalled and uninstalled it a number of times using "pip" but still the file is not there.

Upvotes: 0

Views: 5720

Answers (4)

Thamizhan
Thamizhan

Reputation: 11

for window users

open cmd prompt and type the following to install the stack variable to python 3.x-

pip install pyarabic

To install and run with this code-

from pyarabic.stack import Stack

Upvotes: 1

Rameez Ahmad Dar
Rameez Ahmad Dar

Reputation: 871

After installation of pyarabic import STACK in this manner:

from pyarabic.stack import Stack

Upvotes: 1

aIKid
aIKid

Reputation: 28292

Check your pyarabic folder. Usually it's in Python27\Lib\site-packages\pyarabic.

There, there should be stack.py. If it doesn't exists, re-download pyarabic and then reinstall it.

Upvotes: 2

paljenczy
paljenczy

Reputation: 4899

It seems like stack is not part of the Python Package Index so most probably it is a script you installed manually. The problem can be that the folder containing stack.py is not on your PYTHONPATH.

  1. Open a terminal (Ctrl+ Alt + t) and edit the .bashrc file:

    sudo gedit ~/.bashrc

  2. Add the following line:

    export PYTHONPATH=$PYTHONPATH:/path/to/the/folder/of/your/module

where you should substitute the part after the : to the full path to the directory where stack.py can be found.

I hope this helps.

Upvotes: 0

Related Questions