Python Daily
2.57K subscribers
1.48K photos
53 videos
2 files
38.9K links
Daily Python News
Question, Tips and Tricks, Best Practices on Python Programming Language
Find more reddit channels over at @r_channels
Download Telegram
Tensorflow on JupyterHub unable to detect GPUs

Hello,

​

Thank you for all the content you provide. It plays a crucial factor in my ML education.

​

I am having problems setting up Tensorflow on JupyterHub to detect GPUs (currently, it only uses a CPU). The end goal and idea is to set up the multi-user JupyterHub interface where I can manage GPU resources that run on the Ubuntu server. Some schemes would look like this:

\-Admin

|- user1: 2 usable GPUs

|- user2: 3 usable GPUs

|- user3: 4 usable GPUs

|- user4: 1 usable GPU

​

Currently, I want to divide and conquer the Tensorflow able to detect and use the GPUs part. With the command "nvidia-smi" in JupyterHub Terminal, where I have installed all TF-related libraries along with Docker, I am able to see all GPUs ( NVIDIA-SMI 460.73.01 Driver Version: 460.73.01 CUDA Version: 11.2). Have you experienced the similar problem, and what will you advise me to do? Is it even possible to manage resources with the JupyterHub interface?

​

Thank you in advance for your time.

​

I am looking forward to hearing from you!

/r/IPython
https://redd.it/xfnj5j
If statement for href

Is there a method to create an if statement for an href . Like If the href button is pressed execute a command.

/r/djangolearning
https://redd.it/xgar6e
Advice for getting a Flask job?

Just graduated a bootcamp that went over html/css, JS, Python, Flask, and React. My best project is a Pokemon themed social media app made in Flask. It covers a lot of the big buzzwords

https://pokemonsocial308.herokuapp.com/home

\-User authentication with password encryption

\-fetches JSON from a 2nd Flask database I set up

\-RESTful API routes for the blog posts

\-CRUD functionality for the users and their posts

\-Postgres database

​

I was SO happy with my progress at first. But I'm getting zero responses from job applications so maybe I still have a ways to go.

Lots of job listings mention Docker, Kubernetes, and Amazon Web Services. Maybe I should add those to my list of skills next?

/r/flask
https://redd.it/xgau2z
Saturday Daily Thread: Resource Request and Sharing! Daily Thread

Found a neat resource related to Python over the past week? Looking for a resource to explain a certain topic?

Use this thread to chat about and share Python resources!

/r/Python
https://redd.it/xg72un
Flask Website doesnt behave as i wish, and i dont know why?

Hello there,

I am pretty new to flask and Python an tried to make flask app wich doesnt really work as i wish. I dont get any errors its just not what i want.

So i have 3 Problems:

1. is the Web App has Checkboxes but if i submit one of them, every of them changes
2. why does the checkbox uncheck after reloading the website
3. My third Problem is that i want to get back the value form {{supervisor['number'\]}} if the checkbox is checked

​

<div class="number-items" name="service-number">{{supervisor'number' }}</div>

&#x200B;

HTML:

{% for supervisor in supervisorusers %}
<div class="number-alignment">
<div class="number-container">
<div class="number-items">{{ supervisor'name' }}</div>
<div class="number-items" name="service-number">{{supervisor'number' }}</div>
<div class="number-items">


/r/flask
https://redd.it/xgj6lh
How can I add comments option in the same detailview(another function that shows the blog post)

&#x200B;

https://preview.redd.it/97zys9efrmo91.png?width=840&format=png&auto=webp&s=34b990f9223969f19f382bac6533e619c42409f4

&#x200B;

https://preview.redd.it/whoskiwirmo91.png?width=786&format=png&auto=webp&s=1dc5986ee8e68ff0ab9fb7286ed722112795cacd

im currently using seperate page for adding the comment

I need to click on 'add a comment' then it takes me to add_comment.html

here is the function



class AddCommentView(CreateView): #book
model = Comment
# fields = "__all__"
# fields = ['title','author','genre','content']
form_class = CommentForm
template_name = 'app/add_comment.html'
def form_valid(self, form):
list_obj = List.objects.get(slug = self.kwargs['slug'])
        form.instance.list = list_obj
return super().form_valid(form)
success_url = reverse_lazy("app:list")

is there any way I can do that inside my list_detail.html file?

&#x200B;

&#x200B;

another question

How can I redirect the browser to the same list_detail page? the problem is it contains slug link. and i dont know how to mention that in reverse lazy.

/r/django
https://redd.it/xhirb7
Data doesn't get saved in the database with post request

Hello everyone! I started learning Django a week ago and i decided to create a poll app where users can login, signup, create their own polls and vote on them. Everything is working fine except for the poll creation part (it was also working and i honestly can't remember if i changed something in one of the views, forms or templates because the last time i worked on it it was a couple of days ago... this is also the only time i didn't initialize a repo, sigh).

Basically the problem is that when i write the text in the form and press the "create poll" button i get redirected to the "home", which is what i want, and in the terminal i can see that a post request was made but the data doesn't get saved in the database. I don't get any error, warning or message of any kind. Here is the code:

views.py

@login_required
def create(request):
if request.method == 'POST':
question_form = QuestionForm(request.POST)
choice_form

/r/djangolearning
https://redd.it/xhh8bx
How do you like to "plan out" your Django apps?

Does anyone use any visual tools for something like this? a text document with nesting?

I've got a project I'm pretty excited about, but I will probably wanna think about/work on it from my tablet, while not entirely in the code-base.

I think I may setup VSCode server so I can work from my laptop/tablet too, but this is kind of a bit before that.

It's been ~2 years since I've used Django, and while I felt decently competent with it, I wanna try and plan my project out better than previously.

Cheers!

/r/django
https://redd.it/xhw8b0
Where to host Flask projects for clients?

Hi

I am looking at doing some web development freelance work and want to use flask as the backend as this is the framework i've learned and am comfortable with. This might change in future as I upskill my JS framework knowledge.

However, for now I wanted to know for now where is the best place to host these websites if i'm doing it for clients. I want somewhere I can set it up and know that there are not going to be any issues that cause problems with the clients website down the line.

Love to know peoples experience with this and any recommendations.

Thanks

/r/flask
https://redd.it/xhudv0
Sunday Daily Thread: What's everyone working on this week?

Tell /r/python what you're working on this week! You can be bragging, grousing, sharing your passion, or explaining your pain. Talk about your current project or your pet project; whatever you want to share.

/r/Python
https://redd.it/xh1lwk
Gunicorn flask app deployment in heroku?

I'm getting error messages that are saying permissions are denied.

12:16:41 AM web.1 | 2022-09-19 00:16:41 -0500 1446981 INFO Starting gunicorn 20.1.0
12:16:41 AM web.1 | 2022-09-19 00:16:41 -0500 1446981 INFO Listening at: http://0.0.0.0:5000 (1446981)
12:16:41 AM web.1 | 2022-09-19 00:16:41 -0500 1446981 INFO Using worker: sync
12:16:41 AM web.1 | 2022-09-19 00:16:41 -0500 1446983 INFO Booting worker with pid: 1446983
12:16:42 AM web.1 | Serving Flask app 'app'
12:16:42 AM web.1 |
Debug mode: off
12:16:42 AM web.1 | Permission denied
12:16:42 AM web.1 | 2022-09-19 00:16:42 -0500 1446983 INFO Worker exiting (pid: 1446983)
12:16:42 AM web.1 | 2022-09-19 00:16:42 -0500 1446984 INFO Booting worker with pid: 1446984
12:16:42 AM web.1 | Serving Flask app 'app'
12:16:42 AM web.1 |
Debug mode: off
12:16:42 AM web.1 | Permission denied
12:16:42 AM web.1 | 2022-09-19 00:16:42 -0500 1446984 INFO

/r/flask
https://redd.it/xi2w5g
Monday Daily Thread: Project ideas!

Comment any project ideas beginner or advanced in this thread for others to give a try! If you complete one make sure to reply to the comment with how you found it and attach some source code! If you're looking for project ideas, you might be interested in checking out Al Sweigart's, "The Big Book of Small Python Projects" which provides a list of projects and the code to make them work.

/r/Python
https://redd.it/xhw62a
Creating interactive textbooks

I'm a highschool teacher and I'm looking to develop a number of interactive textbooks to teach my students Python.

I haven't had much experience with Jupyter, but I think either Notebook or Jupyter Book look like the best options.

Just wondering:
1. Which would be better?
2. What would be the best option for hosting?

/r/IPython
https://redd.it/vci5aw
Jupyter cannot find package in virtual environment

I recently installed a modified python package from GitHub. I was able to set it up correctly in a virtual environment and have the module imported. I want to use the package in Jupyter Notebook so I installed a kernel in the virtual environment using

(py_venv) C:\Users\Maaz Shahid\Documents\obspy_example>ipython kernel install --user --name=py_venv

This is the output I get: Installed kernelspec venv in C:\Users\Maaz Shahid\AppData\Roaming\jupyter\kernels\py_venv

Next I open the jupyter notebook and create a new .ipynb file and try to load obspy from obspy import read, but it says ModuleNotFoundError: No module named 'obspy'. I have changed the kernel from python3 to venv in Jupyter but it's not working.

/r/JupyterNotebooks
https://redd.it/xhtc21
Jupyter newbie here. Need to get this done for an assignment but have no idea how. there are a 120 items in reference to age and I would like to split the data into 7 bins for my frequency table. Not sure how to go about it.

/r/JupyterNotebooks
https://redd.it/xi2yoi