Permission Denied Getting error while installing kiteconnect 3.0

RP3436
RP3436 edited February 2018 in Python client
Hi
I am getting following error while installing kiteconnect 3.0 using pip.
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\PINAKI\\Anaconda3\\Lib\\site-packages\\_cffi_backend.cp36-win_amd64.pyd'
Twisted is installed.
OS: windows 10.
Microsoft Visual C++ redistributable (x64) 14.0.24212.0 , Microsoft Visual C++ Buid Tools are also installed.
I need help in resolving this issue.
Regards
  • zartimus
    @RP3436 Can you go through this thread once?

    If not solved, please tell us more about the installation steps you are trying.
  • RP3436
    @zartimus , I tried all the steps mentioned in the thread . However again the same error no. 13 "permision denied. I had restarted my system and tried this.
  • MAG
    Can you give a screenshot of the error? or what is the command you used?
    Permission denied when installing any package typically means you are logged in as a regular user and you need to elevate user privileges by appending 'sudo' to whatever command you are typing at the command prompt.
    So for python as an example, instead of 'pip3 install ...' you would need to do 'sudo pip3 install ...'

    If that doesnt work please paste a screenshot or dm me. I will help you out.
  • RP3436
    @MAG , allow me few minutes. Mean time , few days back when i had tried to upgrade , that time I received the message on Visual C++ redistributable 2014 and that the same can be installed from landinghub. I did follow the instruction but having not found 2014 on that site , I had installed VS C++2015 and build tools. Post that I had tried again. But since then I am getting the same error. I did not however install "twist" at that point of time. Subsequently I installed twist as well, however not in virtualenv. Today I tried even virtual environment but to no help. I will paste the screen shot. I do it from anaconda prompt.
  • Vivek
    @RP3436 Can you please try installing again. We had made some changes to setup.py for installation issues in Windows. We have tested this in different envs on Windows and verified it works fine - https://ci.appveyor.com/project/rainmattertech/pykiteconnect/build/1.0.15
  • RP3436
    Sure, right now I am testing my code on old version, once done I will try upgrading and notifying outcome.
  • RP3436
    @vivek
    I tried both python -m pip install kiteconnect --upgrade --pre (and also pip install kiteconnect --upgrade --pre) on anaconda prompt - but could not succeed. Pl advise what and where to search for possible causes of failure.

    The error message :
    Found existing installation: cffi 1.10.0
    Uninstalling cffi-1.10.0:
    Successfully uninstalled cffi-1.10.0
    Rolling back uninstall of cffi
    Exception:
    Traceback (most recent call last):
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
    File "C:\Users\PINAKI\Anaconda3\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
    PermissionError: [Errno 13] Permission denied: 'C:\\Users\\PINAKI\\Anaconda3\\Lib\\site-packages\\_cffi_backend.cp36-win_amd64.pyd'
  • Vivek
    Vivek edited February 2018
    @RP3436 Seems like this is an issue with Conda environment. Please try the following before installing
    conda config --set always_yes yes --set changeps1 no
    conda update -q conda
    conda info -a
    conda install -q wheel
    python -m pip install --ignore-installed --upgrade setuptools
    python -m pip install kiteconnect --upgrade --pre
    Still not working?. Open your anaconda prompt in admin mode and try again
  • RP3436
    @vivek I followed all the steps . Ran as administrator as well, but of no help - same error message. Should I uninstall python and reinstall? All messages remaining same , I am reproducing a part just in case this is a suspect -
    Installing collected packages: cffi, cryptography, pyOpenSSL, service-identity, kiteconnect, hyperlink
    Found existing installation: cffi 1.10.0
    Uninstalling cffi-1.10.0:
    Successfully uninstalled cffi-1.10.0
    Rolling back uninstall of cffi
  • zartimus
    @RP3436 Can you quickly give the python version and conda version please. Let me try
  • RP3436
    python version is 3.6.3 and conda 4.4.11, conda built 3.0.27
  • zartimus
    @RP3436 You need to install Build Tools for Visual Studio 2017 as administrator. You can download it from here. Make sure visual studio compiler is in your path.
  • RP3436
    @zartimus Thanks, I will follow your instructions and post the outcome. Since the first time the error message talked about Visual Studio++ 2014 version , I had installed the same. Anyway I hope now it gets resolved.
    Regards
  • saivinaymohan
    if you are trying to install kite connector 3 through command prompt:
    In case of windows : open the command prompt as administrator
    In case of ubuntu or mac : use sudo command

  • RP3436
    @vivek @zartimus @sujith
    All instructions on this page followed but still getting the same error:
    Exception:
    Traceback (most recent call last):
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\basecommand.py", line 215, in main
    status = self.run(options, args)
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\commands\install.py", line 342, in run
    prefix=options.prefix_path,
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\req\req_set.py", line 784, in install
    **kwargs
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\req\req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\req\req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
    File "C:\Users\PINAKI\Anaconda3\lib\site-packages\pip\wheel.py", line 323, in clobber
    shutil.copyfile(srcfile, destfile)
    File "C:\Users\PINAKI\Anaconda3\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
    PermissionError: [Errno 13] Permission denied: 'C:\\Users\\PINAKI\\Anaconda3\\Lib\\site-packages\\_cffi_backend.cp36-win_amd64.pyd'

    Can someone who also faced similar issues in upgrading to kiteconnect v3 help? A checklist would be of great help.

    Otherwise there is no point continuing with the subscription.
  • zartimus
    zartimus edited March 2018
    @RP3436 We understand. We are thinking of uploading the wheel distribution for every platforms on pypi so compiling twisted on user end could be eliminated. For a workaround, https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted
    ^ Since you are using python 3.6 and assuming you are on 64 bit, download Twisted‑17.9.0‑cp36‑cp36m‑win_amd64.whl.
    Then install twisted wheel using pip install /path/to/Twisted‑17.9.0‑cp36‑cp36m‑win_amd64.whl

    Now, try installing kiteconnect with pip install kiteconnect --upgrade --pre
    Let me know if it solves it.
  • RP3436
    @zartimus Thanks for your gesture.
    I tried and again got error which I am reproducing below. My guess is, we have to set the path to the installation directory. I am using Anaconda prompt . Anaconda is in the user directory , and the path to site packages is : C:\Users\PINAKI\Anaconda3\Lib\site-packages. Please guide me as to what should I do this time to upgrade kiteconnect without fail. Please mention the lines of code that I must execute at Anaconda prompt , for upgrading kiteconnect. (OS Windows 10 64 bit.)

    ERROR --
    "
    .....
    .....
    .....
    Building wheels for collected packages: kiteconnect
    Running setup.py bdist_wheel for kiteconnect ... error
    Complete output from command C:\Users\PINAKI\Anaconda3\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\PINAKI\\AppData\\Local\\Temp\\pip-build-t8aw9xvs\\kiteconnect\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d C:\Users\PINAKI\AppData\Local\Temp\tmplutgetphpip-wheel- --python-tag cp36:
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\kiteconnect
    copying kiteconnect\connect.py -> build\lib\kiteconnect
    copying kiteconnect\exceptions.py -> build\lib\kiteconnect
    copying kiteconnect\ticker.py -> build\lib\kiteconnect
    copying kiteconnect\__init__.py -> build\lib\kiteconnect
    copying kiteconnect\__version__.py -> build\lib\kiteconnect
    installing to build\bdist.win-amd64\wheel
    running install
    Requirement already satisfied: Twisted==17.9.0 from https://raw.githubusercontent.com/zerodhatech/python-wheels/master/Twisted-17.9.0-cp36-cp36m-win_amd64.whl in c:\users\pinaki\anaconda3\lib\site-packages
    Requirement already satisfied: Automat>=0.3.0 in c:\users\pinaki\anaconda3\lib\site-packages (from Twisted==17.9.0)
    Requirement already satisfied: hyperlink>=17.1.1 in c:\users\pinaki\anaconda3\lib\site-packages (from Twisted==17.9.0)
    Requirement already satisfied: zope.interface>=4.0.2 in c:\users\pinaki\anaconda3\lib\site-packages (from Twisted==17.9.0)
    Requirement already satisfied: constantly>=15.1 in c:\users\pinaki\anaconda3\lib\site-packages (from Twisted==17.9.0)
    Requirement already satisfied: incremental>=16.10.1 in c:\users\pinaki\anaconda3\lib\site-packages (from Twisted==17.9.0)
    Requirement already satisfied: attrs in c:\users\pinaki\anaconda3\lib\site-packages (from Automat>=0.3.0->Twisted==17.9.0)
    Requirement already satisfied: six in c:\users\pinaki\anaconda3\lib\site-packages (from Automat>=0.3.0->Twisted==17.9.0)
    Requirement already satisfied: setuptools in c:\users\pinaki\anaconda3\lib\site-packages (from zope.interface>=4.0.2->Twisted==17.9.0)
    Checking .pth file support in build\bdist.win-amd64\wheel\.\
    C:\Users\PINAKI\Anaconda3\pythonw.exe -E -c pass
    TEST FAILED: build\bdist.win-amd64\wheel\.\ does NOT support .pth files
    error: bad install directory or PYTHONPATH

    You are attempting to install a package to a directory that is not
    on PYTHONPATH and which Python does not read ".pth" files from. The
    installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:

    build\bdist.win-amd64\wheel\.\

    and your PYTHONPATH environment variable currently contains:

    ''

    Here are some of your options for correcting the problem:

    * You can choose a different installation directory, i.e., one that is
    on PYTHONPATH or supports .pth files

    * You can add the installation directory to the PYTHONPATH environment
    variable. (It must then also be on PYTHONPATH whenever you run
    Python and want to use the package(s) you are installing.)

    * You can set up the installation directory to support ".pth" files by
    using one of the approaches described here:

    https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations


    Please make the appropriate changes for your system and try again.

    ----------------------------------------
    Failed building wheel for kiteconnect
    .........
    .........
    .........
    File "C:\Users\PINAKI\Anaconda3\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
    PermissionError: [Errno 13] Permission denied: 'C:\\Users\\PINAKI\\Anaconda3\\Lib\\site-packages\\_cffi_backend.cp36-win_amd64.pyd'

    Regards
  • zartimus
    @RP3436
    We are not able to reproduce this issue here. https://ci.appveyor.com/project/rainmattertech/pykiteconnect/build/1.0.30/job/v7vqg97yjxmcrftm#L121
    ^ is a 64 bit machine with same python version

    Do one thing, try cloning repo
    git clone [email protected]:zerodhatech/pykiteconnect.git
    cd pykiteconnect
    python setup.py install
    If error still persists, reinstall your conda and proceed with the same steps.
  • RP3436
    @zartimus : Can you reflect on this part of the error and if you so feel - suggest some remedial steps:

    Checking .pth file support in build\bdist.win-amd64\wheel\.\
    C:\Users\PINAKI\Anaconda3\pythonw.exe -E -c pass
    TEST FAILED: build\bdist.win-amd64\wheel\.\ does NOT support .pth files
    error: bad install directory or PYTHONPATH

    You are attempting to install a package to a directory that is not
    on PYTHONPATH and which Python does not read ".pth" files from. The
    installation directory you specified (via --install-dir, --prefix, or
    the distutils default setting) was:

    build\bdist.win-amd64\wheel\.\

    and your PYTHONPATH environment variable currently contains:

    ''
    I did not see this error on earlier attempts. Seems access to site package being denied.

    Else , you close the thread.
  • Shaha
    Has anyone able to come pass this error. Was stucked 1 month back with the same. So left upgrade. But still the issue is not solved. We cannot think of testing the new version of kite api if the installation itself doesnt work.
  • Vivek
    Vivek edited March 2018
    @RP3436 Can you try installing with ANACONDA prompt opened as administrator? Also before installing can you run this and check if it goes through?

    pip install https://raw.githubusercontent.com/zerodhatech/python-wheels/master/Twisted-17.9.0-cp36-cp36m-win_amd64.whl

    Also check this similar issue being addressed here - https://stackoverflow.com/questions/43322964/permission-denied-when-installing-tensorflow
  • Vivek
    Vivek edited March 2018
    @Shaha Seems like issue with Windows only under certain circumstances. You can see that we have tested this in most of the Windows environment including Miniconda - https://ci.appveyor.com/project/rainmattertech/pykiteconnect

    You might have to reinstall Miniconda/Ananconda and start a clean environment before trying it. Also as @zartimus mentioned, you can try downloading the package and run python setup.py install
  • RP3436
    Hi @vivek @zartimus : Finally I upgraded to latest version of kiteconnect. However for that I uninstalled anaconda and reinstalled it in a different directory (not the one where OS resides). Did not install twisted separately. Still encountered "permission denied" error. Then I opened anaconda prompt with administrative priviledge, and finally emerged victorious. But , honestly speaking, the process should be made little more user friendly . I hope I am not the only one who faced this problem.
    But in any case , you guys (and others as well) left no stone upturned in helping me solve the issue. Thanks again.
  • nikhil154
    i had this permission denied problem at first , but i reinstalled anaconda with option : install only for me , instead of install for all users . Then it started working for me.
Sign In or Register to comment.