1

I am trying to install the ChartDirector module for python. I downloaded, expanded it and put it in /Users/MyName/anaconda/lib/python2.7/site-packages/ChartDirector along with all the other modules I use.

However when I try and call the module I get the following error:

File "Zones.py", line 1, in <module>
from pychartdir import *
ImportError: No module named pychartdir

I have changed my Python Path to include the exact name of the module:

import sys
sys.path.append("/Users/paulbaranowski/anaconda/lib/python2.7/site-packages/ChartDirector")
print(sys.path)

But I am still getting the same error. Do you have any advice as to how to get this to work?

PaulBarr
  • 919
  • 6
  • 19
  • 33

1 Answers1

3

The ChartDirector for Python library is in the "ChartDirector/lib" subdirectory. You would need to copy everything in "ChartDirector/lib" to the Python module directory. Try something like:

cp -r ChartDirector/lib /Users/paulbaranowski/anaconda/lib/python2.7/site-packages

Another method is to simply copy everything in "ChartDirector/lib" to the directory that contains your "Zones.py" script.

See: ChartDirector for Python Installation

user3100235
  • 127
  • 3
  • Do I just leave all the exec files sitting in site packages? All the other modules have them nicely put within directories. Even changing the path to Users/paulbaranowski/anaconda/lib/python2.7/site-packages/ChartDirector/lib doesn't work. – PaulBarr Mar 09 '16 at 09:10
  • In older version of Linux/Python, it is standard for modules to put all files in the site-packages subdirectory. Newer Linux/Python versions may use subdirectories in site-packages. For backwards compatibility reasons, and because ChartDirector is designed to work with both older and newer versions of Linux and Python, it still suggests people to simply copy all files to the Python module directory. If subdirectory is used, then existing charting code that does not expect the subdirectory will break. – user3100235 Mar 10 '16 at 18:59
  • sys.path.append should work. Otherwise, please try the followings to verify the path: import sys, os path = "/Users/paulbaranowski/anaconda/lib/python2.7/site-packages/ChartDirector/lib" print os.listdir(path) sys.path.append(path) from pychartdir import * If the directory is correct, the output should include pychartdir.py, pychartdir27.so, libchartdir.so and other filenames. If the error message is about pychartdir27 (as opposed to pychartdir), it is normally because the pychartdir27.so does not match the Python OS architecture (like 32-bit/64-bit mismatch). – user3100235 Mar 10 '16 at 19:14