Erwan
Erwan

Reputation: 1145

Issue installing twarc2 in conda environment

I'm trying to install twarc2 in my conda environment (from here) :

conda install -c brown-data-science twarc 

The above command runs fine, if I try it again I get All requested packages already installed.

However when I try to import the module in python:

>>> import twarc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'twarc'

What am I missing?

Upvotes: 1

Views: 141

Answers (2)

merv
merv

Reputation: 76950

The package is now available through Conda Forge.

conda create -n twarc -c conda-forge python=3.10 twarc

This provides v2.12.0 of the PyPI package, which includes both twarc and twarc2 entrypoints.

Upvotes: 1

Erwan
Erwan

Reputation: 1145

I didn't pay attention to the fact that the version of twarc from anaconda that I was installing is only for python2 (and not twarc2). As a result it was installed for python2, and I was trying to import the module in python3.

The correct way to install twarc2 in a conda environment is as follows:

conda create -n twarc2 python=3.10
conda activate twarc2
pip install --upgrade twarc

Upvotes: 0

Related Questions