Need help importing modules into PyCharm












1















I'm trying to run this file that uses the scapy library. It doesnt recognize scapy when I run the code though:



from scapy.all import *

def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print ("ARP Probe from: " + pkt[ARP].hwsrc)

print (sniff(prn=arp_display, filter="arp", store=0, count=10))


This is the error message:



/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Users/me/PycharmProjects/AmazonDash/DashButton
Traceback (most recent call last):
File "/Users/me/PycharmProjects/AmazonDash/DashButton", line 2, in <module>
from scapy.all import *
ImportError: No module named 'scapy'


I installed homebrew and used it to download and install Scapy. I assumed that because I did that, my PyCharm would be able to run the script. I'm not so familiar with Python or PyCharm though, so which step am I missing? I also tried updating the Path in the preferences of PyCharm, pointing it to the scapy folder that was added by homebrew.










share|improve this question























  • I am using a Mac with OSX El Capitan

    – Cazs
    Nov 22 '15 at 8:28











  • Did you build Scapy for the correct version of Python? Does PyCharm let you cmd+click your scapy.all import to view the module source?

    – fisk
    Nov 22 '15 at 8:46











  • Hey Fiskie, thanks for the reply. No it doesnt it gives me this error when I try to click it "Cannot find declaration to go to" I added this path in Preferences -> project interpreter but I am not sure if it is the right one to point to... file:///Users/me/Library/Python/2.7/lib/python/site-packages/homebrew.pth

    – Cazs
    Nov 22 '15 at 18:39


















1















I'm trying to run this file that uses the scapy library. It doesnt recognize scapy when I run the code though:



from scapy.all import *

def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print ("ARP Probe from: " + pkt[ARP].hwsrc)

print (sniff(prn=arp_display, filter="arp", store=0, count=10))


This is the error message:



/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Users/me/PycharmProjects/AmazonDash/DashButton
Traceback (most recent call last):
File "/Users/me/PycharmProjects/AmazonDash/DashButton", line 2, in <module>
from scapy.all import *
ImportError: No module named 'scapy'


I installed homebrew and used it to download and install Scapy. I assumed that because I did that, my PyCharm would be able to run the script. I'm not so familiar with Python or PyCharm though, so which step am I missing? I also tried updating the Path in the preferences of PyCharm, pointing it to the scapy folder that was added by homebrew.










share|improve this question























  • I am using a Mac with OSX El Capitan

    – Cazs
    Nov 22 '15 at 8:28











  • Did you build Scapy for the correct version of Python? Does PyCharm let you cmd+click your scapy.all import to view the module source?

    – fisk
    Nov 22 '15 at 8:46











  • Hey Fiskie, thanks for the reply. No it doesnt it gives me this error when I try to click it "Cannot find declaration to go to" I added this path in Preferences -> project interpreter but I am not sure if it is the right one to point to... file:///Users/me/Library/Python/2.7/lib/python/site-packages/homebrew.pth

    – Cazs
    Nov 22 '15 at 18:39
















1












1








1


1






I'm trying to run this file that uses the scapy library. It doesnt recognize scapy when I run the code though:



from scapy.all import *

def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print ("ARP Probe from: " + pkt[ARP].hwsrc)

print (sniff(prn=arp_display, filter="arp", store=0, count=10))


This is the error message:



/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Users/me/PycharmProjects/AmazonDash/DashButton
Traceback (most recent call last):
File "/Users/me/PycharmProjects/AmazonDash/DashButton", line 2, in <module>
from scapy.all import *
ImportError: No module named 'scapy'


I installed homebrew and used it to download and install Scapy. I assumed that because I did that, my PyCharm would be able to run the script. I'm not so familiar with Python or PyCharm though, so which step am I missing? I also tried updating the Path in the preferences of PyCharm, pointing it to the scapy folder that was added by homebrew.










share|improve this question














I'm trying to run this file that uses the scapy library. It doesnt recognize scapy when I run the code though:



from scapy.all import *

def arp_display(pkt):
if pkt[ARP].op == 1: #who-has (request)
if pkt[ARP].psrc == '0.0.0.0': # ARP Probe
print ("ARP Probe from: " + pkt[ARP].hwsrc)

print (sniff(prn=arp_display, filter="arp", store=0, count=10))


This is the error message:



/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 /Users/me/PycharmProjects/AmazonDash/DashButton
Traceback (most recent call last):
File "/Users/me/PycharmProjects/AmazonDash/DashButton", line 2, in <module>
from scapy.all import *
ImportError: No module named 'scapy'


I installed homebrew and used it to download and install Scapy. I assumed that because I did that, my PyCharm would be able to run the script. I'm not so familiar with Python or PyCharm though, so which step am I missing? I also tried updating the Path in the preferences of PyCharm, pointing it to the scapy folder that was added by homebrew.







python pycharm homebrew scapy






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 22 '15 at 8:26









CazsCazs

63




63













  • I am using a Mac with OSX El Capitan

    – Cazs
    Nov 22 '15 at 8:28











  • Did you build Scapy for the correct version of Python? Does PyCharm let you cmd+click your scapy.all import to view the module source?

    – fisk
    Nov 22 '15 at 8:46











  • Hey Fiskie, thanks for the reply. No it doesnt it gives me this error when I try to click it "Cannot find declaration to go to" I added this path in Preferences -> project interpreter but I am not sure if it is the right one to point to... file:///Users/me/Library/Python/2.7/lib/python/site-packages/homebrew.pth

    – Cazs
    Nov 22 '15 at 18:39





















  • I am using a Mac with OSX El Capitan

    – Cazs
    Nov 22 '15 at 8:28











  • Did you build Scapy for the correct version of Python? Does PyCharm let you cmd+click your scapy.all import to view the module source?

    – fisk
    Nov 22 '15 at 8:46











  • Hey Fiskie, thanks for the reply. No it doesnt it gives me this error when I try to click it "Cannot find declaration to go to" I added this path in Preferences -> project interpreter but I am not sure if it is the right one to point to... file:///Users/me/Library/Python/2.7/lib/python/site-packages/homebrew.pth

    – Cazs
    Nov 22 '15 at 18:39



















I am using a Mac with OSX El Capitan

– Cazs
Nov 22 '15 at 8:28





I am using a Mac with OSX El Capitan

– Cazs
Nov 22 '15 at 8:28













Did you build Scapy for the correct version of Python? Does PyCharm let you cmd+click your scapy.all import to view the module source?

– fisk
Nov 22 '15 at 8:46





Did you build Scapy for the correct version of Python? Does PyCharm let you cmd+click your scapy.all import to view the module source?

– fisk
Nov 22 '15 at 8:46













Hey Fiskie, thanks for the reply. No it doesnt it gives me this error when I try to click it "Cannot find declaration to go to" I added this path in Preferences -> project interpreter but I am not sure if it is the right one to point to... file:///Users/me/Library/Python/2.7/lib/python/site-packages/homebrew.pth

– Cazs
Nov 22 '15 at 18:39







Hey Fiskie, thanks for the reply. No it doesnt it gives me this error when I try to click it "Cannot find declaration to go to" I added this path in Preferences -> project interpreter but I am not sure if it is the right one to point to... file:///Users/me/Library/Python/2.7/lib/python/site-packages/homebrew.pth

– Cazs
Nov 22 '15 at 18:39














4 Answers
4






active

oldest

votes


















1














You probably somehow installed multiple virtualenvs .



Check File -> Settings -> project interpreter in PyCharm; it will let you select the correct python environment to use in the project, and also install packages into that particular environment.






share|improve this answer































    0














    For me, I found my Python3 did not include scapy, so I installed pip3, then used pip3 to install scapy:



    sudo apt-get install -y python3-dev
    pip3 install scapy


    Then, in PyCharm, I did what @gosha-f mentioned:



    PyCharm -> File -> Settings -> Project interpreter


    then find the Add button + on the right, and from there search for, and install, PyCharm's module for scapy (requires internet access).






    share|improve this answer































      0














      For you to be able to use the scapy library you first must go in the preferences of your project on Pycharm .
      Then, in the preferences, search for the Project Interpreter and from there you will be able to add any packages existing in python that you want.
      Then you just have to click on the + in the bottom of the page and search for any package/library that you want to install.
      And now you can use any one that you need...






      share|improve this answer































        0














        CTRL+Shift+s to bring up the settings and have a look at your python interpreter to see if scapy is there (you can also download modules directly this way too)



        that's if you don't go down the virtual env route ofc



        (edit)
        I literally just scrolled down 2 issues and found Unresolved reference with scapy






        share|improve this answer























          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33852939%2fneed-help-importing-modules-into-pycharm%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          You probably somehow installed multiple virtualenvs .



          Check File -> Settings -> project interpreter in PyCharm; it will let you select the correct python environment to use in the project, and also install packages into that particular environment.






          share|improve this answer




























            1














            You probably somehow installed multiple virtualenvs .



            Check File -> Settings -> project interpreter in PyCharm; it will let you select the correct python environment to use in the project, and also install packages into that particular environment.






            share|improve this answer


























              1












              1








              1







              You probably somehow installed multiple virtualenvs .



              Check File -> Settings -> project interpreter in PyCharm; it will let you select the correct python environment to use in the project, and also install packages into that particular environment.






              share|improve this answer













              You probably somehow installed multiple virtualenvs .



              Check File -> Settings -> project interpreter in PyCharm; it will let you select the correct python environment to use in the project, and also install packages into that particular environment.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 22 '15 at 8:46









              Gosha FGosha F

              1977




              1977

























                  0














                  For me, I found my Python3 did not include scapy, so I installed pip3, then used pip3 to install scapy:



                  sudo apt-get install -y python3-dev
                  pip3 install scapy


                  Then, in PyCharm, I did what @gosha-f mentioned:



                  PyCharm -> File -> Settings -> Project interpreter


                  then find the Add button + on the right, and from there search for, and install, PyCharm's module for scapy (requires internet access).






                  share|improve this answer




























                    0














                    For me, I found my Python3 did not include scapy, so I installed pip3, then used pip3 to install scapy:



                    sudo apt-get install -y python3-dev
                    pip3 install scapy


                    Then, in PyCharm, I did what @gosha-f mentioned:



                    PyCharm -> File -> Settings -> Project interpreter


                    then find the Add button + on the right, and from there search for, and install, PyCharm's module for scapy (requires internet access).






                    share|improve this answer


























                      0












                      0








                      0







                      For me, I found my Python3 did not include scapy, so I installed pip3, then used pip3 to install scapy:



                      sudo apt-get install -y python3-dev
                      pip3 install scapy


                      Then, in PyCharm, I did what @gosha-f mentioned:



                      PyCharm -> File -> Settings -> Project interpreter


                      then find the Add button + on the right, and from there search for, and install, PyCharm's module for scapy (requires internet access).






                      share|improve this answer













                      For me, I found my Python3 did not include scapy, so I installed pip3, then used pip3 to install scapy:



                      sudo apt-get install -y python3-dev
                      pip3 install scapy


                      Then, in PyCharm, I did what @gosha-f mentioned:



                      PyCharm -> File -> Settings -> Project interpreter


                      then find the Add button + on the right, and from there search for, and install, PyCharm's module for scapy (requires internet access).







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 21 '18 at 23:14









                      Ghost8472Ghost8472

                      8618




                      8618























                          0














                          For you to be able to use the scapy library you first must go in the preferences of your project on Pycharm .
                          Then, in the preferences, search for the Project Interpreter and from there you will be able to add any packages existing in python that you want.
                          Then you just have to click on the + in the bottom of the page and search for any package/library that you want to install.
                          And now you can use any one that you need...






                          share|improve this answer




























                            0














                            For you to be able to use the scapy library you first must go in the preferences of your project on Pycharm .
                            Then, in the preferences, search for the Project Interpreter and from there you will be able to add any packages existing in python that you want.
                            Then you just have to click on the + in the bottom of the page and search for any package/library that you want to install.
                            And now you can use any one that you need...






                            share|improve this answer


























                              0












                              0








                              0







                              For you to be able to use the scapy library you first must go in the preferences of your project on Pycharm .
                              Then, in the preferences, search for the Project Interpreter and from there you will be able to add any packages existing in python that you want.
                              Then you just have to click on the + in the bottom of the page and search for any package/library that you want to install.
                              And now you can use any one that you need...






                              share|improve this answer













                              For you to be able to use the scapy library you first must go in the preferences of your project on Pycharm .
                              Then, in the preferences, search for the Project Interpreter and from there you will be able to add any packages existing in python that you want.
                              Then you just have to click on the + in the bottom of the page and search for any package/library that you want to install.
                              And now you can use any one that you need...







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Nov 22 '18 at 10:29









                              Nathan AddaNathan Adda

                              11




                              11























                                  0














                                  CTRL+Shift+s to bring up the settings and have a look at your python interpreter to see if scapy is there (you can also download modules directly this way too)



                                  that's if you don't go down the virtual env route ofc



                                  (edit)
                                  I literally just scrolled down 2 issues and found Unresolved reference with scapy






                                  share|improve this answer




























                                    0














                                    CTRL+Shift+s to bring up the settings and have a look at your python interpreter to see if scapy is there (you can also download modules directly this way too)



                                    that's if you don't go down the virtual env route ofc



                                    (edit)
                                    I literally just scrolled down 2 issues and found Unresolved reference with scapy






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      CTRL+Shift+s to bring up the settings and have a look at your python interpreter to see if scapy is there (you can also download modules directly this way too)



                                      that's if you don't go down the virtual env route ofc



                                      (edit)
                                      I literally just scrolled down 2 issues and found Unresolved reference with scapy






                                      share|improve this answer













                                      CTRL+Shift+s to bring up the settings and have a look at your python interpreter to see if scapy is there (you can also download modules directly this way too)



                                      that's if you don't go down the virtual env route ofc



                                      (edit)
                                      I literally just scrolled down 2 issues and found Unresolved reference with scapy







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Nov 23 '18 at 17:04









                                      bain2236bain2236

                                      13




                                      13






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f33852939%2fneed-help-importing-modules-into-pycharm%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          404 Error Contact Form 7 ajax form submitting

                                          How to know if a Active Directory user can login interactively

                                          TypeError: fit_transform() missing 1 required positional argument: 'X'