Addison
Addison

Reputation: 423

Unable to import a package that seems to have been installed

I am trying to work with the TimeSynth Python package in my Conda environment. It is not available on the pkgs list or conda-forge list of Conda-supported packages, so I found this post that seems to get around the issue by installing the package in the Conda environment using pip.

I followed the instructions in the accepted answer, however when I do the last step:

.conda/envs/tcl/bin/pip install timesynth

(tcl is the name of my environment)

It says the requirement is already satisfied:

Requirement already satisfied: timesynth in ./.conda/envs/tcl/lib/python3.6/site-packages (0.2.4)

Requirement already satisfied: scipy in ./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.1)

Requirement already satisfied: jitcxde-common==1.4.1 in ./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.1)

Requirement already satisfied: numpy in ./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.18.1)

Requirement already satisfied: sympy in ./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.8)

Requirement already satisfied: symengine==0.4 in ./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (0.4.0)

Requirement already satisfied: jitcdde==1.4 in ./.conda/envs/tcl/lib/python3.6/site-packages (from timesynth) (1.4.0)

Requirement already satisfied: jinja2 in ./.conda/envs/tcl/lib/python3.6/site-packages (from jitcxde-common==1.4.1->timesynth) (3.0.0a1)

Requirement already satisfied: setuptools in ./.local/lib/python3.6/site-packages (from jitcxde-common==1.4.1->timesynth) (56.2.0)

Requirement already satisfied: MarkupSafe>=1.1 in ./.conda/envs/tcl/lib/python3.6/site-packages (from jinja2->jitcxde-common==1.4.1->timesynth) (2.0.0)

Requirement already satisfied: mpmath>=0.19 in ./.conda/envs/tcl/lib/python3.6/site-packages (from sympy->timesynth) (1.2.1)

However when I run a Python script that imports timesynth, it doesn't recognize the module. Any advice?

EDIT: Per request, here is the start of the file I'm trying to use timesynth in:

import numpy as np
import TimeSynth.timesynth as ts
import matplotlib.pyplot as plt
import seaborn as sns; sns.set()

And the error cites line 2 and states:

ModuleNotFoundError: No module named 'TimeSynth'

Upvotes: 1

Views: 792

Answers (1)

merv
merv

Reputation: 76850

Following the TimeSynth library's example, the import statement of OP

import TimeSynth.timesynth as ts

should instead be

import timesynth as ts

Upvotes: 1

Related Questions