UDST / sanfran_urbansim

An UrbanSim for San Francisco: an example implementation of the new framework
39 stars 27 forks source link

Possible newbie problem: MNLDiscreteChoiceModel does not exist in UrbanSim #17

Closed AntArch closed 9 years ago

AntArch commented 9 years ago

Hi,

I've been going through the UrbanSim getting started pages and have set up my Anaconda instance as per your guidelines. I've then downloaded this repository.

Whenever I import the local python file: utils.py it sends the following command:

from urbansim.models import RegressionModel, SegmentedRegressionModel, MNLDiscreteChoiceModel, SegmentedMNLDiscreteChoiceModel, GrowthRateTransition

This produces the following error:


---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-44a6d6834407> in <module>()
      1 get_ipython().magic(u'load_ext autoreload')
      2 get_ipython().magic(u'autoreload 2')
----> 3 import models
      4 import urbansim.sim.simulation as sim
      5 from urbansim.maps import dframe_explorer

/home/arb/ownCloud/Code/Python/IpythonNotebooks/LUCAS/sanfran_urbansim-master/models.py in <module>()
      1 import urbansim.sim.simulation as sim
      2 import random
----> 3 import utils
      4 import dataset
      5 import variables

/home/arb/ownCloud/Code/Python/IpythonNotebooks/LUCAS/sanfran_urbansim-master/utils.py in <module>()
----> 1 from urbansim.models import RegressionModel, SegmentedRegressionModel, \
      2     MNLDiscreteChoiceModel, SegmentedMNLDiscreteChoiceModel, \
      3     GrowthRateTransition
      4 from urbansim.developer import sqftproforma, developer
      5 import numpy as np

ImportError: cannot import name MNLDiscreteChoiceModel

I've removed the dependency for MNLDiscreteChoiceModel and SegmentedMNLDiscreteChoiceModel but these are used within the example Ipython code - so that doesn't help.

Am I doing something stupid in terms of my environment or do these models not exist in the library any more (or are they referenced in a different way).

Thanks

Ant

Environment:

CPython 2.7.9
IPython 3.1.0

compiler   : GCC 4.4.7 20120313 (Red Hat 4.4.7-1)
system     : Linux
release    : 3.13.0-37-generic
machine    : x86_64
processor  : x86_64
CPU cores  : 4
interpreter: 64bit
Git hash   : 
jiffyclub commented 9 years ago

The problem is likely that you do not have the latest version of UrbanSim. MNLDiscreteChoiceModel is in Urbansim 2.0+.

AntArch commented 9 years ago

That looks about right:

print(urbansim.version)

gives 1.3.

I've removed it from Anaconda

conda remove urbansim

and then installed it using pip instead

pip install urbansim

This gave a version of 2.0.1

_However, I installed this from using the synthicity conda channel_. using the following commands:

conda config --add channels synthicity
conda install urbansim

The binstar repository gives the impression that the released version of urbansim via conda is 2.0.1 and not 1.3.

jiffyclub commented 9 years ago

Our conda channel is out of date at the moment. A bug in either binstar or conda (https://github.com/Binstar/binstar/issues/150) has blocked me from uploading urbansim builds for platforms other than Mac OS X. Once that's fixed I'll be able to upload packages for Linux and Windows.

In the meantime you can probably install UrbanSim using pip since you likely have all the prerequisites already installed. You can try that with pip install urbansim.

AntArch commented 9 years ago

Yep. All done. Code tested and working. Many thanks

jiffyclub commented 9 years ago

:+1: