Nayantara Jeyaraj
Nayantara Jeyaraj

Reputation: 2716

ImportError: No module named 'bword2vec'

I am working on a python project, but I keep getting the following error:

Traceback (most recent call last):
  File "/home/nayantara/PycharmProjects/BSG/run_bsg.py", line 3, in <module>
    from interfaces.interface_configurator import InterfaceConfigurator
  File "/home/nayantara/PycharmProjects/BSG/interfaces/interface_configurator.py", line 4, in <module>
    from interfaces.i_bsg import IBSG
  File "/home/nayantara/PycharmProjects/BSG/interfaces/i_bsg.py", line 1, in <module>
    from models.bsg import BSG
  File "/home/nayantara/PycharmProjects/BSG/models/bsg.py", line 3, in <module>
    from bword2vec import BWord2Vec
ImportError: No module named 'bword2vec'

The relevant line in my bsg.py is just

from bword2vec import BWord2Vec

There's also a file called bword2vec.py within the same folder:

import pickle
import os
import theano
from support import load, write_vectors, kl_spher
from pickle import UnpicklingError
from libraries.tools.ordered_attrs import OrderedAttrs

## theano configuration
theano.optimizer_including = 'cudnn'

class BWord2Vec(OrderedAttrs):
    #Base class for the Bayesian Skip-gram model, it contains methods that can be 
    #used for multiple variants of BSG.
    def __init__(self):
        OrderedAttrs.__init__(self)
        ...
    def initialize_param(self, param_name, param_value):
        ...

Any suggestions?

Upvotes: 0

Views: 243

Answers (1)

varshith ramachandra
varshith ramachandra

Reputation: 29

I have faced this issue before. Can you check if you have an __init__.py in the same folder? If missing, manually create the same and try again. Hopefully, it should work. Please let us know how it goes.

Upvotes: 1

Related Questions