KevinFasusi / supplychainpy

Supplychainpy is a Python library for supply chain analysis, modelling and simulation. The library assists a workflow that is reliant on Excel and VBA.
http://www.supplychainpy.org/
BSD 3-Clause "New" or "Revised" License
292 stars 100 forks source link

Not able to start dashboard #50

Closed chandrantwins closed 7 years ago

chandrantwins commented 7 years ago

I am trying to execute three command to start supplychain . But nothing gave me success. Please supplychain expert.. please help me resolve this issue. Given as below

uwsgi --socket 0.0.0.0:5000 --protocol=http -w wsgi:app

above command gave me below error

Traceback (most recent call last): File "./wsgi.py", line 40, in db.create_all() File "/root/environments/my_env/lib/python3.5/site-packages/flask_sqlalchemy/init.py", line 1007, in create_all self._execute_for_all_tables(app, bind, 'create_all') File "/root/environments/my_env/lib/python3.5/site-packages/flask_sqlalchemy/init.py", line 999, in _execute_for_all_tables op(bind=self.get_engine(app, bind), extra) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/sql/schema.py", line 3949, in create_all tables=tables) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1928, in _run_visitor with self._optional_conn_ctx_manager(connection) as conn: File "/usr/lib/python3.5/contextlib.py", line 59, in enter return next(self.gen) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1921, in _optional_conn_ctx_manager with self.contextual_connect() as conn: File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2112, in contextual_connect self._wrap_pool_connect(self.pool.connect, None), File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2151, in _wrap_pool_connect e, dialect, self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1465, in _handle_dbapi_exception_noconnection exc_info File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 186, in reraise raise value.with_traceback(tb) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2147, in _wrap_pool_connect return fn() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 387, in connect return _ConnectionFairy._checkout(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 766, in _checkout fairy = _ConnectionRecord.checkout(pool) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 516, in checkout rec = pool._do_get() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 1229, in _do_get return self._create_connection() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 333, in _create_connection return _ConnectionRecord(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 461, in init self.__connect(first_connect_check=True) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 651, in __connect connection = pool._invoke_creator(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/strategies.py", line 105, in connect return dialect.connect(*cargs, *cparams) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 393, in connect return self.dbapi.connect(cargs, cparams) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file unable to load app 0 (mountpoint='') (callable not found or import error)

supplychainpy supplychainpy/csvdata/tiny.csv -a -loc / -lx --host 0.0.0.0

2017-09-27 07:41:45,229 - INFO - FUNCTION: Called public api for simple_exponential_smoothing_forecast..simple_exponential_smoothing_forecast EXECUTION TIME: 25.968560626002727 MESSAGE: 2017-09-27 07:41:45,233 - INFO - FUNCTION: supplychainpy.inventory.analyse_uncertain_demand._generate_optimised_ses_forecast EXECUTION TIME: 25.972049572999822 MESSAGE: Called to generate optimised SES forecast. 2017-09-27 07:41:49,919 - INFO - FUNCTION: Called public api for simple_exponential_smoothing_forecast..simple_exponential_smoothing_forecast EXECUTION TIME: 30.65244018600788 MESSAGE: 2017-09-27 07:41:49,920 - INFO - FUNCTION: supplychainpy.inventory.analyse_uncertain_demand._generate_optimised_ses_forecast EXECUTION TIME: 30.653985768003622 MESSAGE: Called to generate optimised SES forecast. [Errno 2] No such file or directory: '/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses_forecast_results' /root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses1.pickle /root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses1.pickle file not present. [Errno 2] No such file or directory: '/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses_forecast_results' 2017-09-27 07:41:49,958 - INFO - Holt's trend corrected exponential smoothing forecast for SKU: KR202-209 Object id: 139753470415760 2017-09-27 07:41:49,965 - INFO - Holt's trend corrected exponential smoothing forecast for SKU: KR202-210 Object id: 139753470415760 Argument 'individual' has incorrect type (expected tuple, got list) [COMPLETED]

loading database ...[COMPLETED]

Loading recommendations into database... Traceback (most recent call last): File "/root/environments/my_env/bin/supplychainpy", line 11, in load_entry_point('supplychainpy==0.0.4', 'console_scripts', 'supplychainpy')() File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/supplychain.py", line 208, in main load_db(file=args.filenames, location=args.location) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/launch_reports.py", line 255, in load_db load.load(file, location) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/reporting/load.py", line 507, in load load_recommendations(summary=ia, forecast=holts_forecast, analysed_order=orders_analysis) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/reporting/load.py", line 516, in load_recommendations recommend = run_sku_recommendation(analysed_orders=analysed_order, forecast=forecast) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/bi/recommendation_generator.py", line 57, in run_sku_recommendation recommend.run(sku.sku_id) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/bi/_recommendation_state_machine.py", line 76, in run (new_state, sku_id) = handler(sku_id) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/bi/_recommendations.py", line 347, in forecast if self._htces_forecast.get(sku)['statistics']['trend']: TypeError: 'NoneType' object is not subscriptable

supplychainpy -a -loc / -lx -cur EUR --debug --host 0.0.0.0

/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/sql/sqltypes.py:596: SAWarning: Dialect sqlite+pysqlite does not support Decimal objects natively, and SQLAlchemy must convert from floating point - rounding errors and other issues may occur. Please consider storing Decimal numbers as strings or integers on this platform for lossless storage. 'storage.' % (dialect.name, dialect.driver)) [2017-09-27 07:47:40,726] ERROR in app: Exception on / [GET] Traceback (most recent call last): File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1517, in handle_user_exception reraise(exc_type, exc_value, tb) File "/root/environments/my_env/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise raise value File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request return self.view_functionsrule.endpoint File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/reporting/blueprints/dashboard/views.py", line 82, in dashboard largest_excess=largest_excess, total_excess=total_excess) File "/root/environments/my_env/lib/python3.5/site-packages/flask/templating.py", line 133, in render_template return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list), File "/root/environments/my_env/lib/python3.5/site-packages/jinja2/environment.py", line 869, in get_or_select_template return self.get_template(template_name_or_list, parent, globals) File "/root/environments/my_env/lib/python3.5/site-packages/jinja2/environment.py", line 830, in get_template return self._load_template(name, self.make_globals(globals)) File "/root/environments/my_env/lib/python3.5/site-packages/jinja2/environment.py", line 804, in _load_template template = self.loader.load(self, name, globals) File "/root/environments/my_env/lib/python3.5/site-packages/jinja2/loaders.py", line 113, in load source, filename, uptodate = self.get_source(environment, name) File "/root/environments/my_env/lib/python3.5/site-packages/flask/templating.py", line 57, in get_source return self._get_source_fast(environment, template) File "/root/environments/my_env/lib/python3.5/site-packages/flask/templating.py", line 85, in _get_source_fast raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: dashboard/dashboard.html 2017-09-27 07:47:40,739 - INFO - 78.104.57.3 - - [27/Sep/2017 07:47:40] "GET / HTTP/1.1" 500 - [2017-09-27 07:47:40,968] ERROR in app: Exception on /favicon.ico [GET] Traceback (most recent call last): File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request rv = self.dispatch_request() File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1590, in dispatch_request self.raise_routing_exception(req) File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1573, in raise_routing_exception raise request.routing_exception File "/root/environments/my_env/lib/python3.5/site-packages/flask/ctx.py", line 294, in match_request self.url_adapter.match(return_rule=True) File "/root/environments/my_env/lib/python3.5/site-packages/werkzeug/routing.py", line 1573, in match raise NotFound() werkzeug.exceptions.NotFound: 404 Not Found: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1982, in wsgi_app response = self.full_dispatch_request() File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1614, in full_dispatch_request rv = self.handle_user_exception(e) File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1512, in handle_user_exception return self.handle_http_exception(e) File "/root/environments/my_env/lib/python3.5/site-packages/flask/app.py", line 1471, in handle_http_exception return handler(e) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/reporting/app.py", line 32, in page_not_found return flask.render_template('404.html'), 404 File "/root/environments/my_env/lib/python3.5/site-packages/flask/templating.py", line 134, in render_template context, ctx.app) File "/root/environments/my_env/lib/python3.5/site-packages/flask/templating.py", line 116, in _render rv = template.render(context) File "/root/environments/my_env/lib/python3.5/site-packages/jinja2/environment.py", line 1008, in render return self.environment.handle_exception(exc_info, True) File "/root/environments/my_env/lib/python3.5/site-packages/jinja2/environment.py", line 780, in handle_exception reraise(exc_type, exc_value, tb) File "/root/environments/my_env/lib/python3.5/site-packages/jinja2/_compat.py", line 37, in reraise raise value.with_traceback(tb) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/reporting/templates/404.html", line 1, in top-level template code {% extends "layouts/base.html" %} File "/root/environments/my_env/lib/python3.5/site-packages/flask/templating.py", line 57, in get_source return self._get_source_fast(environment, template) File "/root/environments/my_env/lib/python3.5/site-packages/flask/templating.py", line 85, in _get_source_fast raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: layouts/base.html

I hope this will help to provide solution. csv data i got it from supplychain documentation only.

KevinFasusi commented 7 years ago

Hi @chandrantwins,

Thanks for posting the issue here, I will take a look at them. I'm not an expert but thanks for the kind words. At first glance, there are several different issues.

As a first step, please navigate to the folder containing the data file. If there is already a reporting.db file in this folder, from your previous attempt to run the application, please delete the file.

Try running the following command in the folder with the .CSV file:

supplychainpy tiny.csv -a -loc ~/supplychainpy/csvdata/tiny.csv -l

It is important that you run the command inside the folder containing the .CSV.

Let me know how you get on.

I have immediately labelled this issue as a bug, as there is a need for better error handling as well as more direct solutions to the issues posted.

chandrantwins commented 7 years ago

Hi Kevin, After executing your command inside csvdata folder.. i got below error

Traceback (most recent call last): File "/root/environments/my_env/bin/supplychainpy", line 11, in load_entry_point('supplychainpy==0.0.4', 'console_scripts', 'supplychainpy')() File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/supplychain.py", line 151, in main launch_load_report(args.filenames, args.location) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/launch_reports.py", line 221, in launch_load_report launcher = tk.Tk() File "/usr/lib/python3.5/tkinter/init.py", line 1871, in init self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use) _tkinter.TclError: no display name and no $DISPLAY environment variable

KevinFasusi commented 7 years ago

Okay, I guess you are using a *nix OS without a desktop environment. That is probably the reason you are getting a Tkinter error, which is why you were using the -lx argument in the first instance. Thanks for reading the docs on that one. Please try:

supplychainpy tiny.csv -a -loc ~/supplychainpy/csvdata/tiny.csv -lx --host 0.0.0.0

So, much like you did in the second attempt but within the directory with the .csv

edited: removed the colon after host.

chandrantwins commented 7 years ago

Hi kevin, supplychainpy tiny.csv -a -loc ~/supplychainpy/csvdata/tiny.csv -lx --host :0.0.0.0 Same error as last time

Traceback (most recent call last): File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2147, in _wrap_pool_connect return fn() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 387, in connect return _ConnectionFairy._checkout(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 766, in _checkout fairy = _ConnectionRecord.checkout(pool) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 516, in checkout rec = pool._do_get() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 1229, in _do_get return self._create_connection() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 333, in _create_connection return _ConnectionRecord(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 461, in init self.__connect(first_connect_check=True) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 651, in __connect connection = pool._invoke_creator(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/strategies.py", line 105, in connect return dialect.connect(*cargs, *cparams) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 393, in connect return self.dbapi.connect(cargs, **cparams) sqlite3.OperationalError: unable to open database file

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/root/environments/my_env/bin/supplychainpy", line 11, in load_entry_point('supplychainpy==0.0.4', 'console_scripts', 'supplychainpy')() File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/supplychain.py", line 208, in main load_db(file=args.filenames, location=args.location) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/launch_reports.py", line 253, in load_db db.create_all() File "/root/environments/my_env/lib/python3.5/site-packages/flask_sqlalchemy/init.py", line 1007, in create_all self._execute_for_all_tables(app, bind, 'create_all') File "/root/environments/my_env/lib/python3.5/site-packages/flask_sqlalchemy/init.py", line 999, in _execute_for_all_tables op(bind=self.get_engine(app, bind), extra) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/sql/schema.py", line 3949, in create_all tables=tables) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1928, in _run_visitor with self._optional_conn_ctx_manager(connection) as conn: File "/usr/lib/python3.5/contextlib.py", line 59, in enter return next(self.gen) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1921, in _optional_conn_ctx_manager with self.contextual_connect() as conn: File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2112, in contextual_connect self._wrap_pool_connect(self.pool.connect, None), File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2151, in _wrap_pool_connect e, dialect, self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 1465, in _handle_dbapi_exception_noconnection exc_info File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/util/compat.py", line 186, in reraise raise value.with_traceback(tb) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/base.py", line 2147, in _wrap_pool_connect return fn() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 387, in connect return _ConnectionFairy._checkout(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 766, in _checkout fairy = _ConnectionRecord.checkout(pool) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 516, in checkout rec = pool._do_get() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 1229, in _do_get return self._create_connection() File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 333, in _create_connection return _ConnectionRecord(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 461, in init self.__connect(first_connect_check=True) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/pool.py", line 651, in __connect connection = pool._invoke_creator(self) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/strategies.py", line 105, in connect return dialect.connect(*cargs, *cparams) File "/root/environments/my_env/lib/python3.5/site-packages/sqlalchemy/engine/default.py", line 393, in connect return self.dbapi.connect(cargs, cparams) sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file

KevinFasusi commented 7 years ago

Hi @chandrantwins,

I have tested the command on both macOS and Linux (Xubuntu Ubuntu 16.04.3 LTS) and the command works. So, I guess it is a system environment issue. I am hopping onto a VM without a desktop environment to see if I can replicate your problem. Can you tell me what OS and virtual environment manager you are using please (Conda, Virtualenv, pyenv...)?

Thanks

chandrantwins commented 7 years ago

Hi kevin.

I am using digitalocean droplet for installing supplychainpy. Distributor ID: Ubuntu Release: 16.04 Codename: xenial I am using Virtualenv . Kevin do you think this is problem? I guess it is a system environment issue How its installed if we have environment issue. Is that make sense?

chandrantwins commented 7 years ago

Hi kevin,

Please tell me your python version how did you installed sqllite3? I dont have any db file inside my csvdata folder.. that is the problem. How did you got reporting.db file?

what is the procedure to produce this file?

Thanks chandran

KevinFasusi commented 7 years ago

Thanks for the information. I will create a digitalocean droplet and replicate your environment. Yep, makes sense, I also think it might be an environment issue. Leave it with me, and I will get back to you as soon as possible.

In the interim, you may want to try setting up an environment on digitalocean with Anaconda and the Conda virtual environment manager. I have used Anaconda with this project. Regardless, it should work with other managers so I will look into this further.

The command you run to start the dashboard generates the 'reporting.db' file. The project works with Python >= 3.5. SQLite (sqlite3) is supported by Python so you should not have to install it separately.

chandrantwins commented 7 years ago

Hi kevin,

currently i dont have MANIFEST.ini file in project.. because its gave me problem during installation.. because its having your computer location.

How should i change this file content. is that helpfull for you to help me

KevinFasusi commented 7 years ago

OK good to know. I don't think that the missing MANIFEST.ini file caused the problem we are working through currently. I will check that as well.

Did you clone the repository to your droplet and use python setup.py sdist?

chandrantwins commented 7 years ago

yes kevin

I will paste commands to know what i did

git clone https://github.com/KevinFasusi/supplychainpy.git cd supplychainpy/ 56 pip install supplychainpy 57 sudo apt-get -y install cython 58 pip install supplychainpy 61 cd supplychainpy/ 62 python setup.py sdist 63 pip install Numpy 64 pip install Pandas 65 pip install Flask 66 pip install Flask-Restful 68 pip install Flask-Restless 69 pip install Flask-ScriptFlask-Script 70 pip install Flask-Script 71 pip install Flask-SqlAlchemy 72 pip install Flask-Uploads 73 pip install Flask-WTF 74 pip install Scipy 75 pip install SqlAlchemy 76 pip install TextBlob 77 pip install matplotlib 78 pip install xlwings 79 pip install openpyxl

170 python setup.py sdist 171 cd dist/ 172 pip install supplychainpy-0.0.4.tar.gz

In between i removed MANIFEST:INI file too

chandrantwins commented 7 years ago

Hi kevin,

I am trying Anaconda environment in digitalocean.. Let you know once its done

chandrantwins commented 7 years ago

Hi kevin, I ran following command . Bold show changed items

supplychainpy tiny.csv -a -loc ~/environments/supplychainpy/supplychainpy/csvdata/ -lx --host 0.0.0.0

Now i got some improvement.. i hope from here you can help me very easily.. Now i got reporting.db file inside csvdata folder.

But i got below error. Its quite long i have highlighted only error. This time i copied success result too..

(my_env) root@SupplyChain:~/environments/supplychainpy/supplychainpy/csvdata# supplychainpy tiny.csv -a -loc ~/environments/supplychainpy/supplychainpy/csvdata/ -lx --host 0.0.0.0 5 loading currency symbols...[COMPLETED]

Analysing file: tiny.csv...2017-09-27 12:27:34,097 - INFO - Extracted unit cost for sku. SKU: KR202-209 UNIT COST: 1001 2017-09-27 12:27:34,098 - INFO - Extracted unit cost for sku. SKU: KR202-209 LEAD-TIME: 2 2017-09-27 12:27:34,099 - INFO - Extracted unit cost for sku. SKU: KR202-209 RETAIL PRICE: 5000 2017-09-27 12:27:34,099 - INFO - Extracted unit cost for sku. SKU: KR202-209 QUANTITY ON HAND: 1003 2017-09-27 12:27:34,099 - INFO - Extracted unit cost for sku. SKU: KR202-209 BACKLOG: 10 2017-09-27 12:27:34,100 - INFO - Extracted unit cost for sku. SKU: KR202-210 UNIT COST: 394 2017-09-27 12:27:34,100 - INFO - Extracted unit cost for sku. SKU: KR202-210 LEAD-TIME: 2 2017-09-27 12:27:34,100 - INFO - Extracted unit cost for sku. SKU: KR202-210 RETAIL PRICE: 1300 2017-09-27 12:27:34,101 - INFO - Extracted unit cost for sku. SKU: KR202-210 QUANTITY ON HAND: 3224 2017-09-27 12:27:34,101 - INFO - Extracted unit cost for sku. SKU: KR202-210 BACKLOG: 10 2017-09-27 12:27:34,101 - INFO - Extracted unit cost for sku. SKU: KR202-211 UNIT COST: 434 2017-09-27 12:27:34,102 - INFO - Extracted unit cost for sku. SKU: KR202-211 LEAD-TIME: 4 2017-09-27 12:27:34,102 - INFO - Extracted unit cost for sku. SKU: KR202-211 RETAIL PRICE: 1200 2017-09-27 12:27:34,102 - INFO - Extracted unit cost for sku. SKU: KR202-211 QUANTITY ON HAND: 390 2017-09-27 12:27:34,102 - INFO - Extracted unit cost for sku. SKU: KR202-211 BACKLOG: 10 2017-09-27 12:27:34,103 - INFO - Extracted unit cost for sku. SKU: KR202-212 UNIT COST: 474 2017-09-27 12:27:34,103 - INFO - Extracted unit cost for sku. SKU: KR202-212 LEAD-TIME: 3 2017-09-27 12:27:34,103 - INFO - Extracted unit cost for sku. SKU: KR202-212 RETAIL PRICE: 10 2017-09-27 12:27:34,104 - INFO - Extracted unit cost for sku. SKU: KR202-212 QUANTITY ON HAND: 390 2017-09-27 12:27:34,104 - INFO - Extracted unit cost for sku. SKU: KR202-212 BACKLOG: 10 2017-09-27 12:27:34,104 - INFO - FUNCTION: supplychainpy._helpers._data_cleansing.clean_orders_data_row_csv EXECUTION TIME: 0.00901835600961931 MESSAGE: clean orders data. [COMPLETED]

Calculating Forecasts.../root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses1.pickle /root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses2.pickle 2017-09-27 12:27:34,182 - INFO - Simple exponential smoothing forecast for SKU: KR202-209 Object id: 139963528073568 2017-09-27 12:27:34,183 - INFO - Started simple exponential smoothing 2017-09-27 12:27:34,184 - INFO - Using solver version to find alpha. 2017-09-27 12:27:34,194 - INFO - Simple exponential smoothing forecast for SKU: KR202-210 Object id: 139963528073736 2017-09-27 12:27:34,197 - INFO - Started simple exponential smoothing 2017-09-27 12:27:34,198 - INFO - Using solver version to find alpha. 2017-09-27 12:27:58,695 - INFO - FUNCTION: Called public api for simple_exponential_smoothing_forecast..simple_exponential_smoothing_forecast EXECUTION TIME: 24.49820647999877 MESSAGE: 2017-09-27 12:27:58,701 - INFO - FUNCTION: supplychainpy.inventory.analyse_uncertain_demand._generate_optimised_ses_forecast EXECUTION TIME: 24.50370171200484 MESSAGE: Called to generate optimised SES forecast. 2017-09-27 12:27:58,925 - INFO - FUNCTION: Called public api for simple_exponential_smoothing_forecast..simple_exponential_smoothing_forecast EXECUTION TIME: 24.741879814013373 MESSAGE: 2017-09-27 12:27:58,926 - INFO - FUNCTION: supplychainpy.inventory.analyse_uncertain_demand._generate_optimised_ses_forecast EXECUTION TIME: 24.74290936201578 MESSAGE: Called to generate optimised SES forecast. [Errno 2] No such file or directory: '/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses_forecast_results' /root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses1.pickle /root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses1.pickle file not present. [Errno 2] No such file or directory: '/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses_forecast_results' 2017-09-27 12:27:58,961 - INFO - Holt's trend corrected exponential smoothing forecast for SKU: KR202-209 Object id: 139963528052632 2017-09-27 12:27:58,967 - INFO - Holt's trend corrected exponential smoothing forecast for SKU: KR202-210 Object id: 139963528043544 Argument 'individual' has incorrect type (expected tuple, got list) [COMPLETED]

loading database ...[COMPLETED]

Loading recommendations into database... Traceback (most recent call last): File "/root/environments/my_env/bin/supplychainpy", line 11, in load_entry_point('supplychainpy==0.0.4', 'console_scripts', 'supplychainpy')() File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/supplychain.py", line 208, in main load_db(file=args.filenames, location=args.location) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/launch_reports.py", line 255, in load_db load.load(file, location) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/reporting/load.py", line 507, in load load_recommendations(summary=ia, forecast=holts_forecast, analysed_order=orders_analysis) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/reporting/load.py", line 516, in load_recommendations recommend = run_sku_recommendation(analysed_orders=analysed_order, forecast=forecast) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/bi/recommendation_generator.py", line 57, in run_sku_recommendation recommend.run(sku.sku_id) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/bi/_recommendation_state_machine.py", line 76, in run (new_state, sku_id) = handler(sku_id) File "/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/bi/_recommendations.py", line 347, in forecast if self._htces_forecast.get(sku)['statistics']['trend']: TypeError: 'NoneType' object is not subscriptable (my_env) root@SupplyChain:~/environments/supplychainpy/supplychainpy/csvdata#

chandrantwins commented 7 years ago

Please can you execute supplychainpy in your environment with my csv data.

Sku,jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec,unit cost,lead-time,retail_price,quantity_on_hand,backlog KR202-209,1509,1855,2665,1841,1231,2598,1988,1988,2927,2707,731,2598,1001,2,5000,1003,10 KR202-210,1006,206,2588,670,2768,2809,1475,1537,919,2525,440,2691,394,2,1300,3224,10 KR202-211,1840,2284,850,983,2737,1264,2002,1980,235,1489,218,525,434,4,1200,390,10 KR202-212,104,2262,350,528,2570,1216,1101,2755,2856,2381,1867,2743,474,3,10,390,10

chandrantwins commented 7 years ago

Hi Kevin,

What do you think regarding this error? How to solve those

2017-09-27 12:27:58,926 - INFO - FUNCTION: supplychainpy.inventory.analyse_uncertain_demand._generate_optimised_ses_forecast EXECUTION TIME: 24.74290936201578 MESSAGE: Called to generate optimised SES forecast. [Errno 2] No such file or directory: '/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses_forecast_results' /root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses1.pickle /root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses1.pickle file not present. [Errno 2] No such file or directory: '/root/environments/my_env/lib/python3.5/site-packages/supplychainpy/_pickled/ses_forecast_results' 2017-09-27 12:27:58,961 - INFO - Holt's trend corrected exponential smoothing forecast for SKU: KR202-209 Object id: 139963528052632 2017-09-27 12:27:58,967 - INFO - Holt's trend corrected exponential smoothing forecast for SKU: KR202-210 Object id: 139963528043544 Argument 'individual' has incorrect type (expected tuple, got list)

chandrantwins commented 7 years ago

Hi Kevin,

Please can you provide me sample csv file which loads perfectly for you.

Thanks Chandran Nepolean

KevinFasusi commented 7 years ago

Hi @chandrantwins

I have been building the environment on a droplet as well. I get the same error:

TypeError: 'NoneType' object is not subscriptable

The TypeError is a separate issue with my code. I recently changed the 'load_script.py' to work on the forecasts in batches because the multiprocessing process pool would sometimes freeze with large files. I have introduced some bugs. I will work through them now and get back to you. When I get a stable install on the droplet, I will let you know so you can clone the repository again.

What you can do while I fix the TypeError issue, is use the 0.0.4 version of the library. I have just tested it on my droplet, and it works. The only problem is that in 0.0.4 the first page of charts is empty if you use the --host 0.0.0.0. This bug that has been fixed but is not currently in a packaged release. The javascript for the charts in this version uses a hardcoded HTTP location for the Ajax calls to the rest API. To work with the 0.0.4 release using:

wget https://github.com/KevinFasusi/supplychainpy/archive/0.0.4.tar.gz

Uninstall the current version of supplychainpy and install the file downloaded from the command above.

As for a file, you can use this file.

If you can test in an Ubuntu (with Desktop Environment) VM using the version above and localhost (instead of 0.0.0.0) you should be able to see the full dashboard at least for a test.

chandrantwins commented 7 years ago

Hi kevin

Thanks for your effort. let me try this tar file and let you know

Thanks Chandran

chandrantwins commented 7 years ago

Hi kevin,

Please mention here.. how did you installed in digital ocean droplets.. i mean command used.. because it will be helpful for me and any newbie coming over here.. Because you said its successfully installed right

Thanks Chandran

KevinFasusi commented 7 years ago

Hi @chandrantwins,

Sure, I used the following commands:

1. git clone https://github.com/KevinFasusi/supplychainpy.git
2. cd supplychainpy/
3. cd
4. curl -O https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86_64.sh
5. bash Anaconda3-4.2.0-Linux-x86_64.sh
6. conda create -n suchpy_env python=3.5
7. source activate suchpy_env
8. pip install Cython
9.  sudo apt update
10. sudo apt upgrade
11. sudo apt install gcc
12. cd supplychainpy/sample_data/
13. ls
14. cp complete_dataset_small.csv ~/
15. cd
16. source activate suchpy_env
17. export PATH=/root/anaconda3/bin:$PATH
18. wget https://github.com/KevinFasusi/supplychainpy/archive/0.0.4.tar.gz
19. pip install 0.0.4.tar.gz
20. supplychainpy complete_dataset_small.csv -a -loc ~/ -lx --host 0.0.0.0

I will write a wiki with a more detailed explanation for using the library with a default route 0.0.0.0 on a server or VPS instead of GUI environment. Thank you for taking the time to explain your issues.

chandrantwins commented 7 years ago

Hi Kevin

If i run your command i am not getting any error but i got struck here

(suchpy_env) root@SupplyChain:~/supplyconda/supplychainpy/supplychainpy/sample_data# supplychainpy complete_dataset_small.csv -a -loc ~/supplyconda/supplychainpy/supplychainpy/sample_data/ -lx --host 0.0.0.0 5 loading currency symbols...[COMPLETED]

Analysing file: complete_dataset_small.csv...[COMPLETED]

its freezing here.. is that common?

KevinFasusi commented 7 years ago

Hi @chandrantwins,

It's likely not freezing; It may take a few minutes to complete. In this release, the next statement 'Calculating Forecasts...' does not print to the console before completing because the thread is busy. The console log works as expected in the repository, however, is not published in a release. Release 0.0.5 will have a more verbose output, as you have seen from building from the source in the repository.

It has been a while since your comment has it finished?

chandrantwins commented 7 years ago

yes Kevin its loading fine. Thanks for your help..

chandrantwins commented 7 years ago

Please access this url http://104.131.1.142:5000/ and please let me know why first page is empty. Is that know bug Kevin?

KevinFasusi commented 7 years ago

Hi @chandrantwins,

Yes, that is the bug in 0.0.4. That only happens when you run the dashboard on a server as a standalone application. If you run on a client using localhost the first front page charts also load. I wish I had caught this before the release.

chandrantwins commented 7 years ago

ok thanks for your information Kevin. Have a nice evening :)

KevinFasusi commented 7 years ago

Thanks, you too Chandran.

KevinFasusi commented 7 years ago

Hi @chandrantwins, I have finally fixed the issue with running the dashboard on a public route (i.e. using --host 0.0.0.0). When you can, please check that the fixes work for you on a DigitalOcean droplet:

1.  git clone https://github.com/KevinFasusi/supplychainpy.git
2. cd supplychainpy/
3. cd
4. curl -O https://repo.continuum.io/archive/Anaconda3-4.2.0-Linux-x86_64.sh
5. bash Anaconda3-4.2.0-Linux-x86_64.sh
6. conda create -n suchpy_env python=3.5
7. source activate suchpy_env
8. pip install Cython
9. python -m textblob.download_corpora
10.  sudo apt update
11. sudo apt upgrade
12. sudo apt install gcc
13. cd supplychainpy/sample_data/
14. ls
15. cp complete_dataset_small.csv ~/
16. cd
17. source activate suchpy_env
18. export PATH=/root/anaconda3/bin:$PATH
19. cd  supplychainpy
20. python setup.py bdist_wheel
21. cd dist/
22. pip install supplychainpy-0.0.5.tar.gz
23. cd
24. supplychainpy complete_dataset_small.csv -a -loc ~/ -lx --host 0.0.0.0 --debug

If when you load the page there is an error. Stop all process and from the root directory, where you ran the last command, run:

(suchpy_env)$ supplychainpy -loc ~/ -lx --host 0.0.0.0 --debug

Please let me know how you get on. Thanks.

chandrantwins commented 7 years ago

Hi Kevin, I am busy with other project. so i cannot check now.. Please close this issue. I will check and let you know by email

ctycer commented 7 years ago

@KevinFasusi I've also been trying to set this up on a Digital Ocean droplet with public route. I'm a layman but I followed your commands pasted here and I was able to access the dashboard remotely but all the formatting and everything was messed up. Before I start over and try and figure out where I went wrong. Does SupplyChainPy even support a setup like this or should I stick with local install only for now?

KevinFasusi commented 7 years ago

Hi @Arcnique,

Sorry, I missed this comment. You did not make a mistake. I experienced the same thing too when clicking through to the SKU detail view. You probably started the attempt before I caught the issue. This problem was with the path to the bootstrap.css file. I have corrected this issue.

Yes, the library should support access remotely. I aimed to support the deployment for remote access. Unfortunately, when the issue with the public route occurred, I was still working through the problem with getting the load script to process large files and use concurrency. I have recently circled back to the public route issue.

I am currently writing up a 'How to Deploy to Server' wiki. As I write this, I am just testing the commands from beginning to end on a Droplet. I should be done tomorrow if you do not mind waiting.

Thanks for taking the time to work through the command, testing features and commenting back here. I think I missed this post because the issue is closed. Please feel free to raise a new issue ticket next time, so your comment is more visible.

ctycer commented 7 years ago

@KevinFasusi Thanks Kevin, this is actually my first Git comment and I knew I was doing it wrong ;). I'll wait for your Wiki to come out. Keep up the good work, as someone coming from a Purchasing background, we need more open source tools like yours.

KevinFasusi commented 7 years ago

@Arcnique Thanks Chris. I appreciate the vote of confidence. Congratulations on your first GitHub post and I am happy it was on this repo. It's great to meet someone from a purchasing background. Please feel free to share your ideas on how the library can better support your requirements. My email address is kevin@supplybi.com.

KevinFasusi commented 7 years ago

Hi Chris (@Arcnique), I posted the wiki. A caveat, the recommendations and simple exponential smoothing forecast are not present in the reports when testing on the cloud server. I am looking into this issue now. However, the wiki guide works for checking the application on a remote server. I will update you again when I have completed the wiki with the second method and fixed the issue.

Have a good weekend.

ctycer commented 7 years ago

@KevinFasusi Thanks Kevin, I'll test it out this weekend.