2

I am trying to install the development version of owlready2; I take the following step;

  1. Extracted the development version downloaded from https://bitbucket.org/jibalamy/owlready2/downloads/
  2. uninstalled previously installed owlready versions
  3. went to the extracted directory and did python setup.py develop

but it is giving me the error that No module named owlready2

The code I am trying to run is below;

from owlready2 import * 
onto = get_ontology("http://myplatform.com/test_sensor_onto") 
onto.imported_ontologies = [] 
sosa = get_ontology("file://sosa.owl").load() 
ssn = get_ontology("file://ssn.owl").load() 
onto.imported_ontologies.append(sosa) 
onto.imported_ontologies.append(ssn) 
sensor = sosa.Sensor("mySensor", namespace = onto) 
onto.save("test_sensor_onto2.owl")

I have also tried to use python setup.py install, but then it gives an error that

sensor =sosa.Sensor("mySensor", namespace = onto) TypeError: 'NoneType' object is not callable

This error is same as for non-development versions of owlready2. I am wondering if I am doing anything wrong while installing the development version or I have to change some settings somewhere?

Muhammad
  • 305
  • 2
  • 6
  • 20

1 Answers1

2

Take a look at your site packages directories with python -c "import site; print(site.getsitepackages())". Make sure a valid link was created in one of those directories for your package.

You might also try using pip -e (editable installs) as an alternative. This is similar to setuptools develop mode. sudo pip install -e /my/package/path. Using pip will install any dependencies required by the package.

setup.py may also require sudo to update the site-wide package directory. Add -v for verbose output: sudo python setup.py -v develop

jspcal
  • 50,847
  • 7
  • 72
  • 76
  • by doing python -c "import site; print(site.getsitepackages())" I found out ['/Users/../anaconda3/lib/python3.6/site-packages']. When I navigated through this directory, I can see "Owlready2.egg-link" file in there. Also, doing your other 2 recommended method sdid not solve the problem. Any further ideas? – Muhammad Jun 24 '18 at 01:39