Error while importing SentenceTransformer in python - python

I have installed package sentence-transformers using "pip install sentence-transformers".
But when I tried to import sentence-transformers in python, I am getting below error.
from sentence_transformers import SentenceTransformer
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\faiss\loader.py", line 34, in <module>
from .swigfaiss import *
File "C:\ProgramData\Anaconda3\lib\site-packages\faiss\swigfaiss.py", line 13, in <module>
from . import _swigfaiss
ImportError: DLL load failed while importing _swigfaiss: The specified module could not be found.
I tried to uninstall and install the package again but it didn't help, also checked the requirement listed in the link below "We recommend Python 3.6 or higher, PyTorch 1.6.0 or higher and transformers v3.1.0 or higher. The code does not work with Python 2.7.", all these requirements are satisfied.
https://pypi.org/project/sentence-transformers/#:~:text=Install%20from%20sources,with%20the%20matching%20CUDA%20Version.
 
Can anyone please help with this.

Related

Can't import pymatgen.core "No module named 'pymatgen.core'"

I've used pip install pymatgen with Python 3.9.1 on Windows 10 to install pymatgen, but I'm getting the following error:
Traceback (most recent call last):
File "D:\code\pymatgen\pymatgen.py", line 1, in <module>
import pymatgen.core as mg
File "D:\code\pymatgen\pymatgen.py", line 1, in <module>
import pymatgen.core as mg
ModuleNotFoundError: No module named 'pymatgen.core'; 'pymatgen' is not a package
I have also tried to install the previous 2 versions but still getting the same error though I can already see it in the pip list
pymatgen 2022.3.22
What am I missing?
Maybe try using conda ? if this doesn't work then there is definitely some dependencies issue
https://pymatgen.org/installation.html

tensorflow - Import Error : cannot import name rnn_cell_impl

Using anaconda, I had installed python 2.7 and tensorflow 1.0.0 to run the package called DeepNovo.
Then I got following error when I tried to run this python script:
Traceback (most recent call last):
File "deepnovo_main.py", line 15, in module import deepnovo_model
File "/Data2/HJE/DeepNovo/deepnovo_model.py", line 43, in <module>
from tensorflow.python.ops import rnn_cell_impl
ImportError: cannot import name rnn_cell_impl
Anyone any ideas?
You want to include a package. That package already required other package. package name is rnn_cell_impl. Make sure path is correct. You can read python modules packages

ModuleNotFoundError: No module named 'six.moves.collections_abc'

i am just starting with machine learning i am following this tutorial from Weights&Bias where they gave us some code and asked to run it i am unable to run the code
First I was getting the error
Keras requires TensorFlow 2.2 or higher
for which I tried this method
Following the advice given here, downgrading Keras did the trick for me without having to touch any other packages. Just do:
pip install keras==2.3.0
from this link
Error "Keras requires TensorFlow 2.2 or higher"
then I started getting the error
Using TensorFlow backend.
Traceback (most recent call last):
File "perceptron-single.py", line 6, in <module>
import wandb
File "C:\Users\hp\AppData\Local\Programs\Python\Python37\lib\site-packages\wandb\__init__.py", line 37, in <module>
from wandb import sdk as wandb_sdk
File "C:\Users\hp\AppData\Local\Programs\Python\Python37\lib\site-packages\wandb\sdk\__init__.py", line 9, in <module>
from .wandb_config import Config # noqa: F401
File "C:\Users\hp\AppData\Local\Programs\Python\Python37\lib\site-packages\wandb\sdk\wandb_config.py", line 10, in <module>
from six.moves.collections_abc import Sequence
*ModuleNotFoundError: No module named 'six.moves.collections_abc'
for which I tried this method
easy_install six
from this link
ImportError: No module named six
but it did not solve my issue
Using this method
pip install --ignore-installed six
From the following link solved the problem for me.
ImportError: No Module named six; six already installed
Although I still don't understand about what was actually wrong and how it got fixed.

Checking Ansible version(ansible --version) but getting following error

And Jinja2 modules Requirement already satisfied
Traceback (most recent call last):
File "/usr/bin/ansible", line 60, in <module>
import ansible.constants as C
File "/usr/lib/python3.7/site-packages/ansible/constants.py", line 12, in <module>
from jinja2 import Template
ModuleNotFoundError: No module named 'jinja2'
This looks like a broken install. A dependency is missing. Try:
pip3 install jinja2
This is not really supposed to happen when you install ansible "normally". If the above does not fix your problem, I suggest you reinstall ansible from scratch on your system

from .cv2 import * ImportError: DLL load failed: The specified module could not be found

I used to play with opencv but now I am not able to use it. When I enter :
import cv 2
I get
import cv2
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
import cv2
File "C:\Program Files\Python36-32\lib\site-packages\cv2\__init__.py", line 3, in <module>
from .cv2 import *
ImportError: DLL load failed: The specified module could not be found.
I have 32 bit Windows 7 and Python 3.6.
I had an issue that really looked like this one.
I installed OpenCV on an conda envrionement and someone had installed numpy unsing pip on the base environment.
Please check that:
all your installed package come from compatible sources
You don't have the same package installed twice
The only way that I could fix the issue was starting from a fresh environment.
Hope it helps

Categories

Resources