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
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
Deploying Django with Heroku vs Other Options—Which is Best for an Individual Developer??

So I’ve been working on finding the “best” way to deploy a Django site as an individual developer and by far the easiest I have found is Heroku.

Other options require you to essentially become a server admin and spend more of your time on infrastructure than actually building your app.

The major concern I hear about with Heroku is the scaling costs…

…But if you are at the point of scaling, shouldn’t your app be making money to cover those costs?

…Aren’t you also saving tons of time and therefore money by not focusing on your server and related infrastructure??

I don’t get the Heroku hate, it honestly seems like the ONLY decent option for a one-person dev team.

We all use Python and Django so we can move fast and bring our ideas to life, but this ideal seems to get lost as soon as we go to deploy our work to the web.

Id like to hear what you all are doing to solve these issues, and deploy your Django sites in a way that works.

What deployment solution do you think is best for a one-person team whose goal is to build a scalable Django site??

Thanks 🙏

/r/django
https://redd.it/xijzq3
Jupyter Failed to start kernel

Jupyter on vscode is refusing to work and produces this log error:

Failed to run jupyter as observable with args notebook --no-browser --notebook-dir="/home/yamen/Projects/Technocolabs" --config=/tmp/06ba2647-9655-4f4f-a96e-982372e4dfac/jupyter_notebook_config.py --NotebookApp.iopub_data_rate_limit=10000000000.0
at t.JupyterConnectionWaiter.rejectStartPromise (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:2145420)
at t._error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:2146021)
at t.__tryOrUnsub (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1335464)
at t.error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1334873)
at t._error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1333758)
at t.error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1333452)
at t.error (/home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:2:1330958)
at /home/yamen/.vscode/extensions/ms-toolsai.jupyter-2022.8.1002431955/out/extension.node.js:7:36891\] {
category: 'jupyterconnection'

/r/JupyterNotebooks
https://redd.it/xhby2a
Rewriting Django Rest Framework app in Flask

I'm working on a Django Rest Framework project that has a chat in it. Now I have a task to create a chat microservice with the same requests and responses as in the DRF project. The problem is that I'm new to Flask. I started searching on how to move a code from DRF to Flask but apparently it's more sophisticated than I expected. Now I'm wondering what would be the best approach for this case.

/r/flask
https://redd.it/xiaeux
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/JupyterNotebooks
https://redd.it/xfnisi
[P] I turned Stable Diffusion into a lossy image compression codec and it performs great!

After playing around with the Stable Diffusion source code a bit, I got the idea to use it for lossy image compression and it works even better than expected.
Details and colab source code here:

https://matthias-buehlmann.medium.com/stable-diffusion-based-image-compresssion-6f1f0a399202?source=friends_link&sk=a7fb68522b16d9c48143626c84172366

/r/MachineLearning
https://redd.it/xix8ef
When to use whitenoise to serve static files?

If I am using Django solely as a backend and rest APIs to connect to a javascript front end, should I still use whitenoise? My thought is no, because Django isn't rendering the html/CSS? I am a relatively new developer, so I hope this isn't a dumb question.

/r/django
https://redd.it/xiuiry
Tuesday Daily Thread: Advanced questions

Have some burning questions on advanced Python topics? Use this thread to ask more advanced questions related to Python.

If your question is a beginner question we hold a beginner Daily Thread tomorrow (Wednesday) where you can ask any question! We may remove questions here and ask you to resubmit tomorrow.

This thread may be fairly low volume in replies, if you don't receive a response we recommend looking at r/LearnPython or joining the Python Discord server at https://discord.gg/python where you stand a better chance of receiving a response.

/r/Python
https://redd.it/xit1rr
How to make a plot with repeating values on the x-axis and that is non-chronological in Jupyter notebook?

I want to plot a graph from sensor data that has time (in the format "hour.minute") on the x-axis and the output (an integer) on the y-axis. The problem is that the time starts at 12.10 PM, takes place over several days and ends at 5.43 PM. I want the graph to show the initial time on the very left and show the rest of the time that follows, with repeated values having their own place on the graph.

I have attached a picture to show what I want the graph to look like, as well as a picture of the Jupyter notebook plot I currently have, and a picture of the .csv file with a look at how the data is arranged, with the measurements starting from the top and ending all the way at the bottom.

/r/IPython
https://redd.it/v7zgw7
Seeking more virtual pair programming buddies for a Django language learning app

I've been developing a language learning app since January and decided to use it as an opportunity to both learn and teach through pair/group programming about two months ago. At that time, I posted here, and we now have a small group of entry to mid level developers working on the app together in both pair/group programming sessions and on our own time.

This has been a wonderful experience for me, so I want to see if others would like to join us as well.

# Details

* We do pair & group programming sessions from 9am-5pm CST (Chicago time), Wednesday - Friday and some Saturdays. Attendees are welcome to join for any portion of the sessions they want.
* We're currently focusing on writing django tests and will soon be implementing more NLP functionality with Spacy. We are also working with the Django rest framework, Google & Bing translation APIs, and we're using a lot of signals. The front end is in React with Ionic.
* The only requirement is that you know and have some experience in Python. I love teaching and can help you setup & learn Django. I'm also an English teacher from the USA: our sessions are good practice for

/r/django
https://redd.it/xjb0kq
Seeking virtual pair programming buddies for a Django language learning app

I've been developing a language learning app since January and decided to use it as an opportunity to both learn and teach through pair/group programming about two months ago. At that time, I posted here, and we now have a small group of entry to mid level developers working on the app together in both pair/group programming sessions and on our own time.

This has been a wonderful experience for me, so I want to see if others would like to join us as well.

# Details

* We do pair & group programming sessions from 9am-5pm CST (Chicago time), Wednesday - Friday and some Saturdays. Attendees are welcome to join for any portion of the sessions they want.
* We're currently focusing on writing django tests and will soon be implementing more NLP functionality with Spacy. We are also working with the Django rest framework, Google & Bing translation APIs, and we're using a lot of signals. The front end is in React with Ionic.
* The only requirement is that you know and have some experience in Python. I love teaching and can help you setup & learn Django. I'm also an English teacher from the USA: our sessions are good practice for

/r/djangolearning
https://redd.it/xjb122