|
I'm going through a Docker course on Udemy, and the instructor provides this Flask app. Unfortunately, it doesn't seem to run, neither in a Docker container nor by itself. Here's the stack trace from the container:code:
|
# ? Jun 3, 2017 18:57 |
|
|
# ? May 15, 2024 10:44 |
|
Looks like it expects redis to be running. Install redis and run it.
|
# ? Jun 3, 2017 18:59 |
|
This isn't going to be too helpful, but that's not exactly a Python issue. Your computer can't find the ip for the hostname that's configured somewhere in that app.
|
# ? Jun 3, 2017 19:00 |
|
it's expecting you to use the compose file - the redis container's address would then be resolved as 'redis', since that's its name, in this bit:quote:redis.exceptions.ConnectionError: Error -5 connecting to redis:6379. No address associated with hostname.
|
# ? Jun 3, 2017 19:04 |
|
SurgicalOntologist posted:Looks like it expects redis to be running. Install redis and run it. The Dockerfile includes a command to install redis 2.10.5. I also installed the latest version on my local, and got the same result. Dex posted:it's expecting you to use the compose file - the redis container's address would then be resolved as 'redis', since that's its name, in this bit: Sorry, the "compose file"? What's that?
|
# ? Jun 3, 2017 20:04 |
|
Nevermind
|
# ? Jun 3, 2017 20:19 |
|
hooah posted:The Dockerfile includes a command to install redis 2.10.5. I also installed the latest version on my local, and got the same result. actually that command(https://github.com/jleetutorial/dockerapp/blob/master/Dockerfile#L2) is installing the python redis client, not a redis server quote:Sorry, the "compose file"? What's that? this thing: https://github.com/jleetutorial/dockerapp/blob/master/docker-compose.yml docker-compose lets you orchestrate multiple containers spinning up, and it handles linking them automatically. when you link containers in docker, you can resolve them by container name. see here: https://docs.docker.com/compose/install/#install-using-pip basically, instead of running that app locally or building that dockerfile directly, you should be running "docker-compose up" in that repo. this would then start up the flask app and a redis server for it to talk to so, the actual error message you're encountering is that the flask app is searching for redis:6379. 'redis' there is a hostname, specifically in this case the hostname of a separate container running a redis server. the application and dockerfile are both written with the expectation that the hostname 'redis' will resolve to a an address where a redis server is running(https://github.com/jleetutorial/dockerapp/blob/master/app/app.py#L6) - this is why trying to run it locally will get you nowhere unless you add 'redis' to your hosts file, or change the code to point to localhost or something docker-compose is written in python so i suppose it's technically relevant to this thread, but probably not. is there a docker thread anywhere? edit: note i haven't actually pulled down that repo to try it since i'm on my windows laptop so this is all guesswork. i have worked with docker a fair bit though Dex fucked around with this message at 20:41 on Jun 3, 2017 |
# ? Jun 3, 2017 20:36 |
|
I've been asking (and see other people asking as well) my docker questions in the Linux thread so maybe try there. It's more active than this one as well.
|
# ? Jun 4, 2017 08:10 |
|
I just ditched PyCharm because I couldn't really get used to it and installed anaconda on my work laptop (windows 10). Now I tried to install some packages but nothing seems to be doing anything. Conda list or search din't return anything so I'm wondering what I'm doing wrong here. Anyone run into this before?
|
# ? Jun 4, 2017 13:15 |
|
PyCharm and Anaconda aren't mutually exclusive. I apologize if I'm saying things you know already, but would you please describe exactly what steps you did to install the packages, then use them? To install packages, do this: code:
code:
Import and use packages like this: Python code:
Dominoes fucked around with this message at 13:38 on Jun 4, 2017 |
# ? Jun 4, 2017 13:34 |
|
I'm aware PyCharm/Anaconda are not mutually exclusive. I just didn't really like PyCharm as and IDE; it's too much for a starter like me. When installing PyCharm I also installed Python 3.6 manually. I uninstalled both of these before installing Anaconda (which has Python packaged with it right?). I didn't get any error messages while installing so I assume it succeeded. When running the Anaconda prompt (as administrator) this is the output I get: code:
|
# ? Jun 4, 2017 15:12 |
|
LochNessMonster posted:I just ditched PyCharm because I couldn't really get used to it and installed anaconda on my work laptop (windows 10). This is a weird thing to say, so just to make sure you didn't accidentally type the wrong thing...you know that PyCharm is an IDE and Anaconda is a package manager?
|
# ? Jun 4, 2017 15:13 |
|
Thermopyle posted:This is a weird thing to say, so just to make sure you didn't accidentally type the wrong thing...you know that PyCharm is an IDE and Anaconda is a package manager? I could see Pycharm being overwhelming if you've never programmed before. Perhaps better to start off with something more familiar feeling first like Sublime Text. That being said, I moved from Sublime to Pycharm in my learning progression and never plan to go back.
|
# ? Jun 4, 2017 15:25 |
|
huhu posted:I could see Pycharm being overwhelming if you've never programmed before. Perhaps better to start off with something more familiar feeling first like Sublime Text. That being said, I moved from Sublime to Pycharm in my learning progression and never plan to go back. Right. But using or not using Anaconda doesn't have anything to do with PyCharm.
|
# ? Jun 4, 2017 15:31 |
|
LochNess - I don't know what the Anaconda prompt is, but by default, the Anaconda installer should add Python and related tools (pip, jupyter qtconsole etc) to your system path, exposing them to a normal terminal. Anaconda does include Python. If these aren't set up, do this: press winkey, type 'environment', press enter, click 'Environment Variables', edit Path, and add your Python scrips path... Someone who's using Ananconda can tell you what it is; for stock python, it's something like 'C:\Users\UserName\AppData\Local\Programs\Python\Python36\Scripts'. Open powershell or command prompt. Type 'pip list' or 'conda list'. What do you see?
|
# ? Jun 4, 2017 15:32 |
|
I see I might have worded things a bit strange. I know Anaconda is a package manager. I replaced PyCharm and am going to try Spyder, which is bundled with Anaconda. If I don't like that I'll go back to Atom. I did use PyCharm to manage the packages of my vanilla python install. So to manage my packages now I tried Anaconda as that seems to get recommended as package manager. None of the commands (search / list / install ) give any output at all. Just a blank line and then a new prompt.
|
# ? Jun 4, 2017 15:54 |
|
Sounds like it's not installed properly. Did you actually install it to System32? Anaconda includes Python and when you install it you can choose to make it the default Python installation for the system - so whenever you run python bla.py it'll use the one in your Anaconda folder and have access to all the packages you installed there etc. Personally I'd just uninstall it and try again, following these instructions - I think the default install location is under AppData
|
# ? Jun 4, 2017 16:36 |
|
LochNessMonster posted:None of the commands (search / list / install ) give any output at all. Just a blank line and then a new prompt. code:
Do this exactly: -Press the win key -type 'powers'; press enter -type 'pip list'; press enter -Post the output here. Dominoes fucked around with this message at 16:50 on Jun 4, 2017 |
# ? Jun 4, 2017 16:43 |
|
Not strictly a python question, I suppose, but I'm trying to build some code to read input from multiple connected mouses (right now 2, but later on it's going to be 4) All of the python libraries I can find for interacting with mouse input seem to just read the cursor position, which is moot if I've got four trackballs controlling one cursor. I did find this super-beta library called inputs but I'm not sure if it even works right? It lags the gently caress out of my cursor and also kinda shifts the cursor on it's own so it's basically impossible for me to debug anything while that library is listening for events. Worst case I just switch all my development over to linux and worry about reading device files but it'd be nice if I could continue to work on my windows box. Anyone got any suggestions here, hopefully a library that does what I need? edit: going to try this Sockser fucked around with this message at 20:01 on Jun 4, 2017 |
# ? Jun 4, 2017 17:37 |
|
Dominoes posted:LochNess - I don't know what the Anaconda prompt is, but by default, the Anaconda installer should add Python and related tools (pip, jupyter qtconsole etc) to your system path, exposing them to a normal terminal. Anaconda does include Python. If these aren't set up, do this: press winkey, type 'environment', press enter, click 'Environment Variables', edit Path, and add your Python scrips path... Someone who's using Ananconda can tell you what it is; for stock python, it's something like 'C:\Users\UserName\AppData\Local\Programs\Python\Python36\Scripts'. Was phone posting so didn't do this until just now. pip/spyder/conda commands now run from Powershell but not from the Anaconda Prompt. There's an option in the Anaconda installer that asked me if I wanted to add the scripts dir to the PATH, but it was recommended not doing so (so I didn't). The weird thing is, that it doesn't work in the Anaconda prompt itself. Same behaviour as before adding it to the path. Same thing happend in powershell but after restarting powershell it worked there. Restarting the anaconda prompt didn't solve so I think there's something not completely right. I think I'll just reinstall. baka kaba posted:Sounds like it's not installed properly. Did you actually install it to System32? I installed in a different location than default. Guess reinstalling is quickest way to fix this. Dominoes posted:Did you do what I suggested? This should not happen; if there's an install or path problem, your output should be this: My previous post was posted from phone so I didn't do that yet. It works in powershell but not in anaconda prompt so I guess something went wrong while installing. I'll fix that by trying to reinstall. Thanks for the good advice all. edit: reinstalled in default path. Conda still doesn't seem to do anything, pip does however. code:
code:
LochNessMonster fucked around with this message at 20:39 on Jun 4, 2017 |
# ? Jun 4, 2017 20:13 |
|
My first instinct was that conda isn't in your $PATH or whatever the Windows equivalent is, but I just popped open a PowerShell (I don't have conda installed on this computer) and typed 'conda list' and it complained to me about conda not being a recognized command. So unless you trimmed that out of your post then I dunno. By the way I think PyCharm is the best thing ever as well, coming from vim for approximately 10 years now (gently caress I'm old). I just started using it though and yeah I could definitely see where it might be confusing and intimidating.
|
# ? Jun 4, 2017 21:02 |
|
Well the weird part is that running conda just gives me a blank line. Not an error about command not found or anything. It's just a blank line and back to the prompt.
|
# ? Jun 4, 2017 21:14 |
|
Boris Galerkin posted:My first instinct was that conda isn't in your $PATH or whatever the Windows equivalent is, but I just popped open a PowerShell (I don't have conda installed on this computer) and typed 'conda list' and it complained to me about conda not being a recognized command. So unless you trimmed that out of your post then I dunno. 10 years of vim isn't that impressive. I learned how to exit vim over 17 years ago and I still don't consider myself old. I too use PyCharm for most of my Python development, but also use Vim sometimes for standalone scripts.
|
# ? Jun 4, 2017 21:27 |
|
I don't know anything about their special shell, I have it added to my $PATH (there's like 3 folders) and I just use the normal command line By the way have they got around to making activate actually work in PowerShell yet? They've been sitting on that issue for years and now it's the default shell in Windows 10 so it would be nice if they could get around to it
|
# ? Jun 4, 2017 21:32 |
|
Just use bash for windows, why worry at all about powershell?
|
# ? Jun 4, 2017 21:41 |
|
Because it's the default shell so it would be nice if it Just Worked
|
# ? Jun 4, 2017 21:47 |
|
Should I worry about conda not doing anything or should I just use pip?
|
# ? Jun 4, 2017 21:53 |
|
Like baka said, don't worry about the Anaconda shell. Conda makes installing binary packages easy, and uniform across WIndows, Mac and Linux. Your alternative is to use installers from this site for packages pip gives you errors with. It's up to you whether you want to use conda or pip; try them out and make your own choice, or better yet, pick one and don't worry about it yet. I chose to stick with pip only, and ditched Anaconda, because dealing with two separate package managers was confusing; you still have to use pip for packages that aren't on conda.
|
# ? Jun 4, 2017 22:13 |
|
Is there a way to scan audio/video file data with Python to pick up on certain sound bits? I'm watching Arrested Development and I'm curious when and how often certain jingles are played, and figured Python might have tools for that.
|
# ? Jun 4, 2017 22:56 |
|
Dominoes posted:Like baka said, don't worry about the Anaconda shell. I just tried to do the following in powershell and that doesn't work either. code:
running the Anaconda command does this: code:
|
# ? Jun 5, 2017 09:54 |
|
Didn't you say above you told the installer to not add anything to your PATH? Are you sure that pip working in that instance is not a carry over of a python installation pre-Anaconda?
|
# ? Jun 5, 2017 13:08 |
|
I recommend stop trying to run the anaconda shell (I assume that's what typing 'anaconda' in powershell does) until you sort the basics out. It seems like a big stumbling block, and is unnecessary. Viking - if you're right about pip being tied to a prev install, he can test by running 'python' in powershell, and checking if 'Anaconda' appears in the Python console's header. I think the best option is a clean install. Use the 'Add or Remove Programs' tool in Windows to remove everything with the name Python or Anaconda in it. Run either the Anaconda, or Python installer again, and we'll go from there if you have any issues. Fixing the path is easy (I posted instructions earlier for the non-Anaconda version), but I think it's best you start fresh. Dominoes fucked around with this message at 13:24 on Jun 5, 2017 |
# ? Jun 5, 2017 13:14 |
|
^^ Yep that would definitely be the easiest way to troubleshoot that.
|
# ? Jun 5, 2017 13:28 |
|
Dominoes posted:I recommend stop trying to run the anaconda shell (I assume that's what typing 'anaconda' in powershell does) until you sort the basics out. It seems like a big stumbling block, and is unnecessary. Viking - if you're right about pip being tied to a prev install, he can test by running 'python' in powershell, and checking if 'Anaconda' appears in the Python console's header. That last post was after a complete uninstall and reinstall of Anaconda. I checked if there were any Python related programs in the Programs/Features list but there weren't. After this reinstall I selected the option to add the executables to the PATH. When the installer was done the pip command gives results back in powershell but conda commands don't do anything. Id it was a PATH issue I'd expect an error message saying the executable can't be found. Should I try to uninstall and see if miniconda works? Edit: The anaconda command was just to see if that did work. Everything I did was in powershell. edit2: system variable path includes the following directories code:
LochNessMonster fucked around with this message at 16:07 on Jun 5, 2017 |
# ? Jun 5, 2017 13:55 |
|
In Ruby and Elixir, I got in the habit of chaining up operations on collections, with chained Enumerable methods in the former and pipes in the latter:code:
|
# ? Jun 5, 2017 21:18 |
|
LochNessMonster posted:That last post was after a complete uninstall and reinstall of Anaconda. I checked if there were any Python related programs in the Programs/Features list but there weren't. Type 'python' in powershell. What do you see? I'm out of ideas.
|
# ? Jun 5, 2017 23:40 |
|
Here's an idea: don't try fancy package managers that I don't even fully get when you have pip and plain old Python that work just fine (Also sit down and learn Pycharm because it's super simple once you get the hang of it)
|
# ? Jun 6, 2017 05:24 |
Cocoa Crispies posted:In Ruby and Elixir, I got in the habit of chaining up operations on collections, with chained Enumerable methods in the former and pipes in the latter: You can chain comprehensions, re-using the same variable name(s) each time. The interpreter will know what you mean. Chaining generator comprehensions in this way is considered idiomatic python, and is fast & efficient! IN Python code:
code:
Python code:
Eela6 fucked around with this message at 06:34 on Jun 6, 2017 |
|
# ? Jun 6, 2017 06:22 |
|
I'm just curious, if you run power she'll in administrative mode (hit the windows key, type powers, right click and choose admin mode) and then type "conda list" does it still show you no output?
|
# ? Jun 6, 2017 06:44 |
|
|
# ? May 15, 2024 10:44 |
|
Do most of you run Python in Windows? Package issues like this and the difficulty getting tensorflow running on Windows drove me to a dual boot Ubuntu setup. It's a pain in the rear end to setup but I've found switching to a Linux build helpful in mitigating stuff like this.
|
# ? Jun 6, 2017 08:07 |