Problem installing instaloader - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Problem installing instaloader (/thread-22055.html) |
Problem installing instaloader - ledgreve - Oct-27-2019 Hello everyone! I am completely new at Python (and programming in general), so please bear with me: I don't know most of the terminology and so on. I would like to ask for help because I am getting desperate. I have been trying to install the instaloader package for several days now, but haven't succeeded and I really need it to work by tomorrow morning. I dowloaded and installed Python 3.8. I tried to install instaloader in a Jupyter Notebook (Anaconda), but it didn't work: "the Python package manager (pip) can only be used from outside of IPython. Please reissue the pip command in a separate terminal or command prompt". (I work with Windows by the way)So I opened Python 3.8 itself and typed several variations of "pip install instaloader"/"$ pip install instaloader"/"$ pip3 install instaloader" but NOTHING works. I always get this error: "SyntaxError: invalid syntax". PLEASE help me? I am sorry to disturb you, but I really don't know what to do anymore. I realise that this probably seems ridiculous to those who have been working with Python for a while, but as I said, I am completely new to this. I would be very grateful for any help! RE: Problem installing instaloader - Larz60+ - Oct-27-2019 from command line (not from python script): pip3 install instaloader RE: Problem installing instaloader - ledgreve - Oct-28-2019 @Larz60+ Thank you! It works now! I have one final connected question. Instaloader also has a Python Module, but it doesn't work when I try to import it in Jupyter Notebooks or in IDLE. Any idea on how I might get this working as well? When I write "import instloader" it responds with: "ModuleNotFoundError: No module named 'instaloader'". Thank you so much for helping me! RE: Problem installing instaloader - Larz60+ - Oct-28-2019 Quote:but it doesn't workThat doesn't tell me much, please be more specific RE: Problem installing instaloader - ledgreve - Oct-29-2019 @Larz60+ In Instaloader's Github documentation (https://instaloader.github.io/as-module.html) it says you need to "start with getting an instance of Instaloader" by entering the following code: "import instaloader # Get instance L = instaloader.Instaloader()" I typed this code into a Jupyter notebook and in an IDLE file. However, when I run the code, I get the following error message: "--------------------------------------------------------------------------- ModuleNotFoundError Traceback (most recent call last) <ipython-input-1-bd65c83a9f8a> in <module> ----> 1 import instaloader 2 3 # Get instance 4 L = instaloader.Instaloader() ModuleNotFoundError: No module named 'instaloader'" So I don't really know how I can solve this problem. I checked it again and instaloader was installed with pip, so I don't think that's the problem. Thank you very much for helping me! I really appreciate it! RE: Problem installing instaloader - Larz60+ - Oct-29-2019 please show actual code (within code tags) and complete, unaltered error tracebacks in error tags RE: Problem installing instaloader - ledgreve - Oct-29-2019 @Larz60+ I'm sorry, I didn't realise! Thank you for telling me! I added the tags below: In Instaloader's Github documentation (https://instaloader.github.io/as-module.html) it says you need to "start with getting an instance of Instaloader" by entering the following code: import instaloader # Get instance L = instaloader.Instaloader()I typed this code into a Jupyter notebook and in an IDLE file. However, when I run the code, I get the following error message: So I don't really know how I can solve this problem. I checked it again and instaloader was installed with pip, so I don't think that's the problem.Thank you very much for helping me! I really appreciate it! RE: Problem installing instaloader - snippsat - Oct-29-2019 (Oct-27-2019, 02:17 PM)ledgreve Wrote: I dowloaded and installed Python 3.8. I tried to install instaloader in a Jupyter Notebook (Anaconda), but it didn't work: "the Python package manager (pip) can only be used from outside of IPython. Please reissue the pip command in a separate terminal or command prompt". (I work with Windows by the way)I think you get confused here,Anaconda or Python(from python.org) can both work fine together on a OS i guess you use Windows? You get SyntaxError error because you do this in Python shell,all should be done from command line on OS,eg cmd(Windows). Remember that theses version standalone,so install instaloader on Anaconda dos not make it work on Python(from python.org) and the other way around.Have install tutorial here Windows | Anaconda. So if start with Python(from python.org) which is the main version in Windows path. # Check Python E:\div_code λ python -V Python 3.7.3 # Check pip E:\div_code λ pip -V pip 19.3.1 from c:\python37\lib\site-packages\pip (python 3.7) # install E:\div_code λ pip install instaloader Collecting instaloader Downloading .... Successfully installed instaloader-4.2.10 # Test that it work E:\div_code λ python Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 21:26:53) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import instaloader >>> instaloader.__version__ '4.2.10' >>> L = instaloader.Instaloader() >>> help(L.download_stories) Help on method download_stories in module instaloader.instaloader: download_stories(userids: Union[List[Union[int, instaloader.structures.Profile]] ..... Download available stories from user followees or all stories of users whose ID are given. Does not mark stories as seen. To use this, one needs to be logged in ..... >>> exit()So now it work on Python(from python.org),but it will not work on Anaconda. Here i do from Script folder where Anaconda has pip or conda .# check pip see now that it point to Anaconda folder G:\Anaconda3\Scripts λ pip -V pip 19.0.3 from G:\Anaconda3\lib\site-packages\pip (python 3.7) G:\Anaconda3\Scripts λ pip install instaloader Collecting instaloader ..... Successfully installed instaloader-4.2.10So if i eg start JupyterLab from Anaconda it will work as i have installed it to Anaconda as shown over. import sys import instaloader print(sys.executable) # Help you see what Python version is used print(instaloader.__version__) # Get instance L = instaloader.Instaloader() help(L.download_stories)
RE: Problem installing instaloader - ledgreve - Nov-04-2019 Thank you @Snippsat! I was able to install the pip instaloader package in my Jupyter Notebook by entering following code: import sys !{sys.executable} -m pip install instaloaderWhen I ran the cell I got a confirmation that instaloader had been installed, but I can't get the Instaloader Module to work in Jupyter Notebooks (via Anaconda Navigator). When I tried to run examples of code they provided themselves to extract Instagram posts, like L = Instaloader() for post in L.get_hashtag_posts(urbanphotography): L.download_post(post, target='#'+urbanphotography)(https://instaloader.github.io/as-module.html#instaloader-main-class, under "Instagram Structures" - "Posts") The short text/number to the left of the cell in the notebook simply remained "In [*]" instead of changing to, for example, "In [2]" and nothing happened. Do you know what might be the problem here? I also tried to run one of their advanced instaloader examples (https://instaloader.github.io/codesnippets.html) in the same Jupyter notebook as a test: from datetime import datetime from itertools import dropwhile, takewhile import instaloader L = instaloader.Instaloader() posts = L.get_hashtag_posts('urbanphotography') SINCE = datetime(2007, 5, 1) UNTIL = datetime(2007, 3, 1) for post in takewhile(lambda p: p.date > UNTIL, dropwhile(lambda p: p.date > SINCE, posts)): print(post.date) L.download_post(post, '#urbanphotography')But when I ran this code in the cell, I received the following error message: Could someone please help me to get it running, so I can extract the json and metadata-txt files I need? I already asked the same question in Instaloader's issue-section several days ago, but so far nobody has replied and I really need to get this working as soon as possible.Thank you in advance! RE: Problem installing instaloader - snippsat - Nov-04-2019 Look at link: Discussed in issue #121. There is a example that work. from datetime import datetime from itertools import dropwhile, takewhile import instaloader L = instaloader.Instaloader() posts = L.get_hashtag_posts('milfgarden') # or # posts = instaloader.Profile.from_username(L.context, PROFILE).get_posts() SINCE = datetime(2015, 5, 1) UNTIL = datetime(2015, 3, 1) for post in takewhile(lambda p: p.date > UNTIL, dropwhile(lambda p: p.date > SINCE, posts)): print(post.date) L.download_post(post, '#milfgarden')I do get the same Warning,but it's just a Warning if code works you will get output.
|