Heroku flask app failed: importlib.util module not found Error





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I am trying to deploy a flask app with Heroku and I'm getting ModuleNotFoundError. I don't understand why because all of my modules are up-to-date. Does anybody know how to fix this error?



CMD image



Here is the code that I am using. The code builds fine, I just can't seem to get the app to deploy correctly.



import pickle
from flask import Flask
from flask import request,jsonify,render_template,abort
import pandas as pd
from sklearn.externals import joblib
import json
import numpy as np
from importlib import util

app = Flask(__name__)

model = pickle.load(open("Final_Gait_Model.sav", "rb"))

@app.route('/')
def home():
return render_template('index.html')

@app.route('/api', methods=['POST'])
def get_info_predict():

features =
result = request.form

L_Ank_Force_LHS = float(input('Left Ankle Force at LHS (N): '))
features.append(L_Ank_Force_LHS)

L_Ank_Moment_Z_LHS = float(input('Left Ankle Moment (Z-axis) at LHS (Nm): '))
features.append(L_Ank_Moment_Z_LHS)

L_Knee_Force_LHS = float(input('Left Knee Force at LHS (N): '))
features.append(L_Knee_Force_LHS)

L_Ank_Moment_Y_Stance=float(input('Left Ankle Moment (Y-axis) during stance (Nm): '))
features.append(L_Ank_Moment_Y_Stance)

L_Knee_Vel_Y_Stance=float(input('Left Knee Angular Velocity (Y-axis) during stance (deg/s): '))
features.append(L_Knee_Vel_Y_Stance)

L_Knee_Vel_Z_Stance=float(input('Left Knee Angular Velocity (Z-Axis) during stance (deg/s): '))
features.append(L_Knee_Vel_Z_Stance)

R_Ank_Moment_Y_Stance=float(input('Right Ankle Moment (Y-axis) during stance (Nm): '))
features.append(R_Ank_Moment_Y_Stance)

R_Knee_Vel_Y_Stance=float(input('Right Knee Angular Velocity (Y-axis) during stance (deg/s): '))
features.append(R_Knee_Vel_Y_Stance)

R_Knee_Vel_Z_Stance=float(input('Right Knee Angular Velocity (Z-axis) during stance (deg/s): '))
features.append(R_Knee_Vel_Z_Stance)

R_Ank_Force_RHS=float(input('Right Ankle Force at RHS (N): '))
features.append(R_Ank_Force_RHS)

R_Ank_Moment_Z_RHS=float(input('Right Ankle Moment (Z-axis) at RHS (Nm): '))
features.append(R_Ank_Moment_Z_RHS)

R_Knee_Force_RHS=float(input('Right Kneed Force at RHS (N): '))
features.append(R_Knee_Force_RHS)

features = input_to_one_hot(features)

prediction = model.predict([features])[0]

return json.dumps({'Injury Classisfication':prediction});


if __name__ == '__main__':
app.run(port=8080, debug = True)









share|improve this question

























  • I'm haven't used importlib yet, but reading your python script, you don't use it in your script. Do you really need it ?

    – Dinko Pehar
    Nov 27 '18 at 10:20











  • Yeah I don't use it in my script at all however the module is a requirement to deploy the app for Heroku. It is listed in the requirements.txt file. For some reason it is having trouble finding the module during deployment. I think it may have something to do with sklearn because I get the deprecation warning for importlib when I build the code.

    – Mitchell Leefers
    Nov 27 '18 at 18:26


















1















I am trying to deploy a flask app with Heroku and I'm getting ModuleNotFoundError. I don't understand why because all of my modules are up-to-date. Does anybody know how to fix this error?



CMD image



Here is the code that I am using. The code builds fine, I just can't seem to get the app to deploy correctly.



import pickle
from flask import Flask
from flask import request,jsonify,render_template,abort
import pandas as pd
from sklearn.externals import joblib
import json
import numpy as np
from importlib import util

app = Flask(__name__)

model = pickle.load(open("Final_Gait_Model.sav", "rb"))

@app.route('/')
def home():
return render_template('index.html')

@app.route('/api', methods=['POST'])
def get_info_predict():

features =
result = request.form

L_Ank_Force_LHS = float(input('Left Ankle Force at LHS (N): '))
features.append(L_Ank_Force_LHS)

L_Ank_Moment_Z_LHS = float(input('Left Ankle Moment (Z-axis) at LHS (Nm): '))
features.append(L_Ank_Moment_Z_LHS)

L_Knee_Force_LHS = float(input('Left Knee Force at LHS (N): '))
features.append(L_Knee_Force_LHS)

L_Ank_Moment_Y_Stance=float(input('Left Ankle Moment (Y-axis) during stance (Nm): '))
features.append(L_Ank_Moment_Y_Stance)

L_Knee_Vel_Y_Stance=float(input('Left Knee Angular Velocity (Y-axis) during stance (deg/s): '))
features.append(L_Knee_Vel_Y_Stance)

L_Knee_Vel_Z_Stance=float(input('Left Knee Angular Velocity (Z-Axis) during stance (deg/s): '))
features.append(L_Knee_Vel_Z_Stance)

R_Ank_Moment_Y_Stance=float(input('Right Ankle Moment (Y-axis) during stance (Nm): '))
features.append(R_Ank_Moment_Y_Stance)

R_Knee_Vel_Y_Stance=float(input('Right Knee Angular Velocity (Y-axis) during stance (deg/s): '))
features.append(R_Knee_Vel_Y_Stance)

R_Knee_Vel_Z_Stance=float(input('Right Knee Angular Velocity (Z-axis) during stance (deg/s): '))
features.append(R_Knee_Vel_Z_Stance)

R_Ank_Force_RHS=float(input('Right Ankle Force at RHS (N): '))
features.append(R_Ank_Force_RHS)

R_Ank_Moment_Z_RHS=float(input('Right Ankle Moment (Z-axis) at RHS (Nm): '))
features.append(R_Ank_Moment_Z_RHS)

R_Knee_Force_RHS=float(input('Right Kneed Force at RHS (N): '))
features.append(R_Knee_Force_RHS)

features = input_to_one_hot(features)

prediction = model.predict([features])[0]

return json.dumps({'Injury Classisfication':prediction});


if __name__ == '__main__':
app.run(port=8080, debug = True)









share|improve this question

























  • I'm haven't used importlib yet, but reading your python script, you don't use it in your script. Do you really need it ?

    – Dinko Pehar
    Nov 27 '18 at 10:20











  • Yeah I don't use it in my script at all however the module is a requirement to deploy the app for Heroku. It is listed in the requirements.txt file. For some reason it is having trouble finding the module during deployment. I think it may have something to do with sklearn because I get the deprecation warning for importlib when I build the code.

    – Mitchell Leefers
    Nov 27 '18 at 18:26














1












1








1








I am trying to deploy a flask app with Heroku and I'm getting ModuleNotFoundError. I don't understand why because all of my modules are up-to-date. Does anybody know how to fix this error?



CMD image



Here is the code that I am using. The code builds fine, I just can't seem to get the app to deploy correctly.



import pickle
from flask import Flask
from flask import request,jsonify,render_template,abort
import pandas as pd
from sklearn.externals import joblib
import json
import numpy as np
from importlib import util

app = Flask(__name__)

model = pickle.load(open("Final_Gait_Model.sav", "rb"))

@app.route('/')
def home():
return render_template('index.html')

@app.route('/api', methods=['POST'])
def get_info_predict():

features =
result = request.form

L_Ank_Force_LHS = float(input('Left Ankle Force at LHS (N): '))
features.append(L_Ank_Force_LHS)

L_Ank_Moment_Z_LHS = float(input('Left Ankle Moment (Z-axis) at LHS (Nm): '))
features.append(L_Ank_Moment_Z_LHS)

L_Knee_Force_LHS = float(input('Left Knee Force at LHS (N): '))
features.append(L_Knee_Force_LHS)

L_Ank_Moment_Y_Stance=float(input('Left Ankle Moment (Y-axis) during stance (Nm): '))
features.append(L_Ank_Moment_Y_Stance)

L_Knee_Vel_Y_Stance=float(input('Left Knee Angular Velocity (Y-axis) during stance (deg/s): '))
features.append(L_Knee_Vel_Y_Stance)

L_Knee_Vel_Z_Stance=float(input('Left Knee Angular Velocity (Z-Axis) during stance (deg/s): '))
features.append(L_Knee_Vel_Z_Stance)

R_Ank_Moment_Y_Stance=float(input('Right Ankle Moment (Y-axis) during stance (Nm): '))
features.append(R_Ank_Moment_Y_Stance)

R_Knee_Vel_Y_Stance=float(input('Right Knee Angular Velocity (Y-axis) during stance (deg/s): '))
features.append(R_Knee_Vel_Y_Stance)

R_Knee_Vel_Z_Stance=float(input('Right Knee Angular Velocity (Z-axis) during stance (deg/s): '))
features.append(R_Knee_Vel_Z_Stance)

R_Ank_Force_RHS=float(input('Right Ankle Force at RHS (N): '))
features.append(R_Ank_Force_RHS)

R_Ank_Moment_Z_RHS=float(input('Right Ankle Moment (Z-axis) at RHS (Nm): '))
features.append(R_Ank_Moment_Z_RHS)

R_Knee_Force_RHS=float(input('Right Kneed Force at RHS (N): '))
features.append(R_Knee_Force_RHS)

features = input_to_one_hot(features)

prediction = model.predict([features])[0]

return json.dumps({'Injury Classisfication':prediction});


if __name__ == '__main__':
app.run(port=8080, debug = True)









share|improve this question
















I am trying to deploy a flask app with Heroku and I'm getting ModuleNotFoundError. I don't understand why because all of my modules are up-to-date. Does anybody know how to fix this error?



CMD image



Here is the code that I am using. The code builds fine, I just can't seem to get the app to deploy correctly.



import pickle
from flask import Flask
from flask import request,jsonify,render_template,abort
import pandas as pd
from sklearn.externals import joblib
import json
import numpy as np
from importlib import util

app = Flask(__name__)

model = pickle.load(open("Final_Gait_Model.sav", "rb"))

@app.route('/')
def home():
return render_template('index.html')

@app.route('/api', methods=['POST'])
def get_info_predict():

features =
result = request.form

L_Ank_Force_LHS = float(input('Left Ankle Force at LHS (N): '))
features.append(L_Ank_Force_LHS)

L_Ank_Moment_Z_LHS = float(input('Left Ankle Moment (Z-axis) at LHS (Nm): '))
features.append(L_Ank_Moment_Z_LHS)

L_Knee_Force_LHS = float(input('Left Knee Force at LHS (N): '))
features.append(L_Knee_Force_LHS)

L_Ank_Moment_Y_Stance=float(input('Left Ankle Moment (Y-axis) during stance (Nm): '))
features.append(L_Ank_Moment_Y_Stance)

L_Knee_Vel_Y_Stance=float(input('Left Knee Angular Velocity (Y-axis) during stance (deg/s): '))
features.append(L_Knee_Vel_Y_Stance)

L_Knee_Vel_Z_Stance=float(input('Left Knee Angular Velocity (Z-Axis) during stance (deg/s): '))
features.append(L_Knee_Vel_Z_Stance)

R_Ank_Moment_Y_Stance=float(input('Right Ankle Moment (Y-axis) during stance (Nm): '))
features.append(R_Ank_Moment_Y_Stance)

R_Knee_Vel_Y_Stance=float(input('Right Knee Angular Velocity (Y-axis) during stance (deg/s): '))
features.append(R_Knee_Vel_Y_Stance)

R_Knee_Vel_Z_Stance=float(input('Right Knee Angular Velocity (Z-axis) during stance (deg/s): '))
features.append(R_Knee_Vel_Z_Stance)

R_Ank_Force_RHS=float(input('Right Ankle Force at RHS (N): '))
features.append(R_Ank_Force_RHS)

R_Ank_Moment_Z_RHS=float(input('Right Ankle Moment (Z-axis) at RHS (Nm): '))
features.append(R_Ank_Moment_Z_RHS)

R_Knee_Force_RHS=float(input('Right Kneed Force at RHS (N): '))
features.append(R_Knee_Force_RHS)

features = input_to_one_hot(features)

prediction = model.predict([features])[0]

return json.dumps({'Injury Classisfication':prediction});


if __name__ == '__main__':
app.run(port=8080, debug = True)






python heroku






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '18 at 13:53









davidism

66.7k12187196




66.7k12187196










asked Nov 27 '18 at 0:58









Mitchell LeefersMitchell Leefers

185




185













  • I'm haven't used importlib yet, but reading your python script, you don't use it in your script. Do you really need it ?

    – Dinko Pehar
    Nov 27 '18 at 10:20











  • Yeah I don't use it in my script at all however the module is a requirement to deploy the app for Heroku. It is listed in the requirements.txt file. For some reason it is having trouble finding the module during deployment. I think it may have something to do with sklearn because I get the deprecation warning for importlib when I build the code.

    – Mitchell Leefers
    Nov 27 '18 at 18:26



















  • I'm haven't used importlib yet, but reading your python script, you don't use it in your script. Do you really need it ?

    – Dinko Pehar
    Nov 27 '18 at 10:20











  • Yeah I don't use it in my script at all however the module is a requirement to deploy the app for Heroku. It is listed in the requirements.txt file. For some reason it is having trouble finding the module during deployment. I think it may have something to do with sklearn because I get the deprecation warning for importlib when I build the code.

    – Mitchell Leefers
    Nov 27 '18 at 18:26

















I'm haven't used importlib yet, but reading your python script, you don't use it in your script. Do you really need it ?

– Dinko Pehar
Nov 27 '18 at 10:20





I'm haven't used importlib yet, but reading your python script, you don't use it in your script. Do you really need it ?

– Dinko Pehar
Nov 27 '18 at 10:20













Yeah I don't use it in my script at all however the module is a requirement to deploy the app for Heroku. It is listed in the requirements.txt file. For some reason it is having trouble finding the module during deployment. I think it may have something to do with sklearn because I get the deprecation warning for importlib when I build the code.

– Mitchell Leefers
Nov 27 '18 at 18:26





Yeah I don't use it in my script at all however the module is a requirement to deploy the app for Heroku. It is listed in the requirements.txt file. For some reason it is having trouble finding the module during deployment. I think it may have something to do with sklearn because I get the deprecation warning for importlib when I build the code.

– Mitchell Leefers
Nov 27 '18 at 18:26












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53491306%2fheroku-flask-app-failed-importlib-util-module-not-found-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53491306%2fheroku-flask-app-failed-importlib-util-module-not-found-error%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen