plasticityai / magnitude

A fast, efficient universal vector embedding utility package.
MIT License
1.62k stars 119 forks source link

cannot import from pymagnitude :module 'pytest' has no attribute 'mark' #61

Closed laifi closed 4 years ago

laifi commented 5 years ago

Hello , This error occurs when i try to import from pymagnitude !

from pymagnitude import Magnitude File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/init.py", line 80, in from pymagnitude.third_party.allennlp.commands.elmo import ElmoEmbedder File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/commands/init.py", line 8, in from allennlp.commands.configure import Configure File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/commands/init.py", line 8, in from allennlp.commands.configure import Configure File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/commands/configure.py", line 25, in from allennlp.common.configuration import configure, Config, render_config File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/common/configuration.py", line 20, in from allennlp.data.iterators import DataIterator File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/init.py", line 3, in from allennlp.data.dataset_readers.dataset_reader import DatasetReader File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/dataset_readers/dataset_reader.py", line 6, in from allennlp.data.instance import Instance File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/instance.py", line 5, in from allennlp.data.fields.field import Field File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/fields/init.py", line 11, in from allennlp.data.fields.knowledge_graph_field import KnowledgeGraphField File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/fields/knowledge_graph_field.py", line 18, in from allennlp.data.token_indexers.token_indexer import TokenIndexer File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/token_indexers/init.py", line 7, in from allennlp.data.token_indexers.dep_label_indexer import DepLabelIndexer File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/token_indexers/dep_label_indexer.py", line 10, in from allennlp.data.tokenizers.token import Token File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/tokenizers/init.py", line 9, in from allennlp.data.tokenizers.word_tokenizer import WordTokenizer File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/tokenizers/word_tokenizer.py", line 11, in from allennlp.data.tokenizers.word_stemmer import WordStemmer, PassThroughWordStemmer File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/pymagnitude/third_party/allennlp/data/tokenizers/word_stemmer.py", line 3, in from nltk.stem import PorterStemmer as NltkPorterStemmer File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/nltk/init.py", line 143, in from nltk.chunk import * File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/nltk/chunk/init.py", line 157, in from nltk.chunk.api import ChunkParserI File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/nltk/chunk/api.py", line 13, in from nltk.parse import ParserI File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/nltk/parse/init.py", line 100, in from nltk.parse.transitionparser import TransitionParser File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/nltk/parse/transitionparser.py", line 22, in from sklearn.datasets import load_svmlight_file File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/sklearn/datasets/init.py", line 22, in from .twenty_newsgroups import fetch_20newsgroups File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/sklearn/datasets/twenty_newsgroups.py", line 44, in from ..feature_extraction.text import CountVectorizer File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/sklearn/feature_extraction/init.py", line 10, in from . import text File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/sklearn/feature_extraction/text.py", line 28, in from ..preprocessing import normalize File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/sklearn/preprocessing/init.py", line 6, in from ._function_transformer import FunctionTransformer File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/sklearn/preprocessing/_function_transformer.py", line 5, in from ..utils.testing import assert_allclose_dense_sparse File "/home/yosri/anaconda3/envs/ml/lib/python3.7/site-packages/sklearn/utils/testing.py", line 720, in skip_if_32bit = pytest.mark.skipif(_IS_32BIT, AttributeError: module 'pytest' has no attribute 'mark'

AjayP13 commented 4 years ago

Can you try installing on just normal Python/pip3 (not anaconda)? Does that work?

laifi commented 4 years ago

Can you try installing on just normal Python/pip3 (not anaconda)? Does that work?

By default the python interepter is the Anaconda one, So I used the full path /usr/bin/python in bash to use the default python interpreter. it works! Thanks

cwgavin commented 4 years ago

For other people who come here with the same issue, my solution is

pip3 uninstall pytest
pip3 install pytest

Note it's pip3 instead of pip since I'm using Python3