This advise doesn't seem to work. I'm trying to use the hashbang to switch to python 3.6: #!/usr/bin/python3.6
However, environment is still 3.8 when using save/run button, causing numpy issues:
File "/usr/lib/python3.8/site-packages/numpy/core/overrides.py", line 16, in <module>
add_docstring(
RuntimeError: implement_array_function method already has a docstring
I have 3.6 configured from my .bashrc but I don't think it's being sourced in that console. Am I missing something?
I am having this problem too! and it has gotten very overwhelming. the system does not even build the wxPython , numpy . I defined python 3.6 as my work environment and it keeps giving me the console on python3.8. Any solution not involving me to continue spending days trying to get this solved will be appreciated. NONE of the solutions in the wiki, forums, help or anywhere else online has solved it. I have lost days in this issue. Please forward an intuitive step by step solution. The libraries run well in the stand alone python application so seems the problem may be pythonanywhere. I hope the team to have compassive human delicacy to respond.
I have a similar issue where I cloned my GitHub repo and create a virtual environment with :
mkvirtualenv --python=/usr/bin/python3.8.5 crs_venv
Then when I want to install my packages, I run:
pip install -r requirements.txt
I get a depreciation warning and an error:
ERROR: ipykernel-5.3.4-py3-none-any.whl is not a supported wheel on this platform.
if I instead install using
pip3
, I get an error saying
ERROR: Could not find a version that satisfies the requirement anaconda-client==1.7.2 (from -r requirements.txt (line 2)) (from versions:
1.1.1, 1.2.2)
ERROR: No matching distribution found for anaconda-client==1.7.2 (from -r requirements.txt (line 2))
Any help would be appreciated.
Having the following error.
~/my_site/personal_web/mysite/my_app (main)$ python trial.py
Traceback (most recent call last):
File "trial.py", line 37, in <module>
with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as server:
TypeError: __init__() got an unexpected keyword argument 'context'
This did not happen 2 months ago. I had made sure all of my codes were running, but now none of them do.
[edit by admin: formatting]
Perhaps you were using a virtualenv earlier? When you're not using a virtualenv, the command python will run Python 2.7 (which is unfortunately a requirement of the operating system).
I can see that your website is configured to use a virtualenv called myproj, so if you wan the code that you're running from a Bash console to use that env, then you should first run the command
workon myproj
-- once that is done, you'll see (myproj) appear in the prompt in Bash, and the command python will be bound to the version of Python that your website uses, with all of the modules that you've installed into the virtualenv available.
Traceback (most recent call last):
File "/home/fingerprint/mysite/finegerprint_pipline.py", line 79, in <module>
results = fingerprint_pipline(img)
File "/home/fingerprint/mysite/finegerprint_pipline.py", line 44, in fingerprint_pipline
gabor_img = gabor_filter(normim, angles, freq)
File "/home/fingerprint/mysite/./utils/gabor_filter.py", line 43, in gabor_filter
array = np.linspace(-block_size,block_size,(2*block_size + 1))
File "<__array_function__ internals>", line 5, in linspace
File "/usr/local/lib/python3.10/site-packages/numpy/core/function_base.py", line 120, in linspace
num = operator.index(num)
TypeError: 'numpy.float64' object cannot be interpreted as an integer
Getting above error. i have tried it in my local with 3.7 and it was working fine. i have tried to create the VD for python 3.7 but it atkes as 3.10 by default. can you please help me on this
[edit by admin: formatting]
Yes, using save and run button in the editor.i have created the webapp using python 3.7 but when run the python file getting the error which seems like 'usr/local/lib/python3.10/site-packages/numpy/core/function_base.py'.
Please suggest i m kind of stuck here
Hi,Thank you so much! It's working fine. but now i have my Flask API. when i am trying to run my app i am getting below errors.
importsysfromutils.poincareimportcalculate_singularitiesfromutils.segmentationimportcreate_segmented_and_variance_imagesfromutils.normalizationimportnormalizefromutils.gabor_filterimportgabor_filterfromutils.frequencyimportridge_freqfromutilsimportorientationfromutils.crossing_numberimportcalculate_minutiaesfromtqdmimporttqdmfromutils.skeletonizeimportskeletonizefromflaskimportFlaskapplication=Flask(__name__)sys.path.insert(0,'/home/fingerprint/mysite/utils')@application.route('/')defhello_world():return""" <title>Python Anywhere hosted web application</title> </head> <h1>Hello, World!</h1> This is the default welcome page for a <a href="https://www.pythonanywhere.com/">PythonAnywhere</a> hosted web application. Find out more about how to configure your own web application by visiting the <a href="https://www.pythonanywhere.com/web_app_setup/">web app setup</a> page </body> </html>"""deffingerprint_pipline(input_img):block_size=16# pipe line picture re https://www.cse.iitk.ac.in/users/biometrics/pages/111.JPG# normalization -> orientation -> frequency -> mask -> filtering# normalization - removes the effects of sensor noise and finger pressure differences.normalized_img=normalize(input_img.copy(),float(100),float(100))# color threshold# threshold_img = normalized_img# _, threshold_im = cv.threshold(normalized_img,127,255,cv.THRESH_OTSU)# cv.imshow('color_threshold', normalized_img); cv.waitKeyEx()# ROI and normalisation(segmented_img,normim,mask)=create_segmented_and_variance_images(normalized_img,block_size,0.2)# orientationsangles=orientation.calculate_angles(normalized_img,W=block_size,smoth=False)orientation_img=orientation.visualize_angles(segmented_img,mask,angles,W=block_size)# find the overall frequency of ridges in Wavelet Domainfreq=ridge_freq(normim,mask,angles,block_size,kernel_size=5,minWaveLength=5,maxWaveLength=15)# create gabor filter and do the actual filteringgabor_img=gabor_filter(normim,angles,freq)# thinning oor skeletonizethin_image=skeletonize(gabor_img)# minutiasminutias=calculate_minutiaes(thin_image)# singularitiessingularities_img=calculate_singularities(thin_image,angles,1,block_size,mask)# visualize pipeline stage by stageoutput_imgs=[input_img,normalized_img,segmented_img,orientation_img,gabor_img,thin_image,minutias,singularities_img]foriinrange(len(output_imgs)):iflen(output_imgs[i].shape)==2:output_imgs[i]=cv.cvtColor(output_imgs[i],cv.COLOR_GRAY2RGB)results=np.concatenate([np.concatenate(output_imgs[:4],1),np.concatenate(output_imgs[4:],1)]).astype(np.uint8)returnresultsif__name__=='__main__':# open imagesimg_dir='./sample_inputs/*'output_dir='./output/'defopen_images(directory):images_paths=glob(directory)print(images_paths)returnnp.array([cv.imread(img_path,0)forimg_pathinimages_paths])images=open_images(img_dir)# image pipelineos.makedirs(output_dir,exist_ok=True)fori,imginenumerate(tqdm(images)):results=fingerprint_pipline(img)cv.imwrite(output_dir+str(i)+'.png',results)# cv.imshow('image pipeline', results); cv.waitKeyEx()
If you're running it from bash, use the python3.8 command instead of just python
If you want to use it for a website you've set up on the "Web" page, just change the version on that page.
If you're trying to run it some other way, could you give some more details?
Sorry, we have had to rate-limit your feedback sending. Please try again in a few moments...
Thanks for the feedback! Our tireless devs will get back to you soon.